Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve logging when generating config files #5510

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5510.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve logging when generating config files.
3 changes: 2 additions & 1 deletion synapse/config/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def load_or_generate_config(cls, description, argv):
)
(config_path,) = config_files
if not cls.path_exists(config_path):
print("Generating config file %s" % (config_path,))
if config_args.keys_directory:
config_dir_path = config_args.keys_directory
else:
Expand Down Expand Up @@ -331,7 +332,7 @@ def load_or_generate_config(cls, description, argv):
else:
print(
(
"Config file %r already exists. Generating any missing key"
"Config file %r already exists. Generating any missing config"
" files."
)
% (config_path,)
Expand Down
1 change: 1 addition & 0 deletions synapse/config/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def generate_files(self, config):
signing_key_path = config["signing_key_path"]

if not self.path_exists(signing_key_path):
print("Generating signing key file %s" % (signing_key_path,))
with open(signing_key_path, "w") as signing_key_file:
key_id = "a_" + random_string(4)
write_signing_keys(signing_key_file, (generate_signing_key(key_id),))
Expand Down
4 changes: 4 additions & 0 deletions synapse/config/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ def generate_files(self, config):
log_config = config.get("log_config")
if log_config and not os.path.exists(log_config):
log_file = self.abspath("homeserver.log")
print(
"Generating log config file %s which will log to %s"
% (log_config, log_file)
)
with open(log_config, "w") as log_config_file:
log_config_file.write(DEFAULT_LOG_CONFIG.substitute(log_file=log_file))

Expand Down