aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-10 23:30:37 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-10 23:34:43 -0400
commit93dfb1203715bd275d0eed6c8cccf6b6db76fd95 (patch)
treec6da409f3293b602cbc2c0c54feeba694402fa9a /src/or
parent6e2ef4bc5ef882b3434d2fe15c1007b4ac711374 (diff)
downloadtor-93dfb1203715bd275d0eed6c8cccf6b6db76fd95.tar.gz
tor-93dfb1203715bd275d0eed6c8cccf6b6db76fd95.zip
Remember log messages that happen before logs are configured
(And replay them once we know our first real logs.) This is an implementation for issue 6938. It solves the problem of early log mesages not getting sent to log files, but not the issue of early log messages not getting sent to controllers.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c6
-rw-r--r--src/or/main.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index ba9c944f56..85e36c7534 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1023,7 +1023,7 @@ options_act_reversible(const or_options_t *old_options, char **msg)
int running_tor = options->command == CMD_RUN_TOR;
int set_conn_limit = 0;
int r = -1;
- int logs_marked = 0;
+ int logs_marked = 0, logs_initialized = 0;
int old_min_log_level = get_min_log_level();
/* Daemonize _first_, since we only want to open most of this stuff in
@@ -1153,6 +1153,7 @@ options_act_reversible(const or_options_t *old_options, char **msg)
*msg = tor_strdup("Failed to init Log options. See logs for details.");
goto rollback;
}
+ logs_initialized = 1;
commit:
r = 0;
@@ -1165,6 +1166,9 @@ options_act_reversible(const or_options_t *old_options, char **msg)
tor_free(severity);
tor_log_update_sigsafe_err_fds();
}
+ if (logs_initialized) {
+ flush_log_messages_from_startup();
+ }
{
const char *badness = NULL;
diff --git a/src/or/main.c b/src/or/main.c
index 094120fecf..ffbed6edbe 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2954,7 +2954,7 @@ tor_main(int argc, char *argv[])
update_approx_time(time(NULL));
tor_threads_init();
- init_logging();
+ init_logging(0);
#ifdef USE_DMALLOC
{
/* Instruct OpenSSL to use our internal wrappers for malloc,