summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-05-20 08:41:54 +0000
committerRoger Dingledine <arma@torproject.org>2004-05-20 08:41:54 +0000
commit66dd21b7a44d3e194029fac99fe986adac9940a7 (patch)
tree014be9689c2e4f0fa40f4d9205b66ce7b762eb4c
parent034110e761e5c2ac44357d128cea6b2380490548 (diff)
downloadtor-66dd21b7a44d3e194029fac99fe986adac9940a7.tar.gz
tor-66dd21b7a44d3e194029fac99fe986adac9940a7.zip
some more patching
svn:r1910
-rw-r--r--src/or/config.c5
-rw-r--r--src/or/main.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 9afcc2a1e5..f089aa92c6 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -757,6 +757,7 @@ static void add_single_log(struct config_line_t *level_opt,
add_stream_log(levelMin, levelMax, "<stderr>", stderr);
log_fn(LOG_WARN, "Cannot write to LogFile '%s': %s.", file_opt->value,
strerror(errno));
+ return;
}
log_fn(LOG_NOTICE, "Successfully opened LogFile '%s', redirecting output.",
file_opt->value);
@@ -775,8 +776,10 @@ void config_init_logs(or_options_t *options)
struct config_line_t *opt = options->LogOptions;
/* Special case if nothing is specified. */
- if(!opt)
+ if(!opt) {
add_single_log(NULL, NULL, options->RunAsDaemon);
+ /* don't return yet, in case we want to do a debuglogfile below */
+ }
/* Special case for if first option is LogLevel. */
if (opt && !strcasecmp(opt->key, "LogLevel")) {
diff --git a/src/or/main.c b/src/or/main.c
index e2f7b37b81..50280f074c 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -551,7 +551,6 @@ static int init_from_config(int argc, char **argv) {
log_fn(LOG_ERR,"Reading config failed. For usage, try -h.");
return -1;
}
- close_logs(); /* we'll close, then open with correct loglevel if necessary */
/* Setuid/setgid as appropriate */
if(options.User || options.Group) {
@@ -565,6 +564,8 @@ static int init_from_config(int argc, char **argv) {
start_daemon(options.DataDirectory);
}
+ close_logs(); /* we'll close, then open with correct loglevel if necessary */
+
/* Configure the log(s) */
config_init_logs(&options);
@@ -578,7 +579,7 @@ static int init_from_config(int argc, char **argv) {
finish_daemon();
}
- /* Write our pid to the pid file. if we do not have write permissions we
+ /* Write our pid to the pid file. If we do not have write permissions we
* will log a warning */
if(options.PidFile)
write_pidfile(options.PidFile);
@@ -852,7 +853,7 @@ void exit_function(void)
int tor_main(int argc, char *argv[]) {
/* give it somewhere to log to initially */
- add_stream_log(LOG_INFO, LOG_ERR, "<stdout>", stdout);
+ add_stream_log(LOG_NOTICE, LOG_ERR, "<stdout>", stdout);
log_fn(LOG_NOTICE,"Tor v%s. This is experimental software. Do not use it if you need anonymity.",VERSION);
if (network_init()<0) {