[or-cvs] log to stdout while parsing config,

Roger Dingledine arma at seul.org
Sat Oct 18 00:13:10 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	main.c 
Log Message:
log to stdout while parsing config,
otherwise we log to nothing and give no feedback!



Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- main.c	17 Oct 2003 05:23:48 -0000	1.136
+++ main.c	18 Oct 2003 00:13:08 -0000	1.137
@@ -780,17 +780,21 @@
 
 int tor_main(int argc, char *argv[]) {
 
+  /* give it somewhere to log to initially */
+  add_stream_log(LOG_INFO, "<stdout>", stdout);
+
   if(getconfig(argc,argv,&options)) {
     log_fn(LOG_ERR,"Reading config file failed. exiting.");
     return -1;
   }
   log_set_severity(options.loglevel); /* assign logging severity level from options */
+  close_logs(); /* close stdout, then open with correct loglevel if necessary */
+  if(!options.LogFile && !options.RunAsDaemon)
+    add_stream_log(options.loglevel, "<stdout>", stdout);
   if(options.DebugLogFile)
     add_file_log(LOG_DEBUG, options.DebugLogFile);
   if(options.LogFile)
     add_file_log(options.loglevel, options.LogFile);
-  if(!options.LogFile && !options.RunAsDaemon)
-    add_stream_log(options.loglevel, "<stdout>", stdout);
 
   global_read_bucket = options.TotalBandwidth; /* start it at 1 second of traffic */
   stats_prev_global_read_bucket = global_read_bucket;



More information about the tor-commits mailing list