diff --git a/src/app/config/config.c b/src/app/config/config.c index 37eab22912..0a8c0d536d 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -3428,20 +3428,17 @@ options_validate_single_onion(or_options_t *options, char **msg) * normalizing the contents of options. * * On error, tor_strdup an error explanation into *msg. - * - * XXX - * If from_setconf, we were called by the controller, and our - * Log line should stay empty. If it's 0, then give us a default log - * if there are no logs defined. */ STATIC int options_validate(or_options_t *old_options, or_options_t *options, - or_options_t *default_options, int from_setconf, char **msg) + or_options_t *default_options, int from_setconf_unused, + char **msg) { config_line_t *cl; const char *uname = get_uname(); int n_ports=0; int world_writable_control_socket=0; + (void)from_setconf_unused; /* 29211 TODO: Remove this from the API. */ tor_assert(msg); *msg = NULL; @@ -3504,14 +3501,6 @@ options_validate(or_options_t *old_options, or_options_t *options, check_network_configuration(server_mode(options)); - /* Special case on first boot if no Log options are given. */ - if (!options->Logs && !options->RunAsDaemon && !from_setconf) { - if (quiet_level == 0) - config_line_append(&options->Logs, "Log", "notice stdout"); - else if (quiet_level == 1) - config_line_append(&options->Logs, "Log", "warn stdout"); - } - /* Validate the tor_log(s) */ if (options_init_logs(old_options, options, 1)<0) REJECT("Failed to validate Log options. See logs for details."); @@ -5733,6 +5722,12 @@ options_init_logs(const or_options_t *old_options, or_options_t *options, ok = 1; elts = smartlist_new(); + if (options->Logs == NULL && !run_as_daemon && !validate_only) { + /* When no logs are given, the default behavior is to log nothing (if + RunAsDaemon is set) or to log based on the quiet level otherwise. */ + add_default_log_for_quiet_level(quiet_level); + } + for (opt = options->Logs; opt; opt = opt->next) { log_severity_list_t *severity; const char *cfg = opt->value;