Don't log stderr by default for main daemon
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Mon, 23 May 2011 15:40:57 +0000 (15:40 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Mon, 23 May 2011 15:40:57 +0000 (15:40 +0000)
New option to override

bin/inputs/run.py

index 87545aeb3d2ce060a8906192bd220255cd51af17..02a55efc0c37ea01ddb6f5552213dd7603e52344 100644 (file)
@@ -158,6 +158,10 @@ def main():
     parser.add_option('--db',
         help='Process packets locally',
         action='store_true', dest='todb', default=False)
+    parser.add_option('--log-stderr',
+        help='Log stderr output to /var/log/ais/deamon.stderr\n'
+             'Only works when --background',
+        action='store_true', dest='log_stderr', default=False)
     parser.add_option('--tcp-listeners-port',
         help='TCP global OutPeer port',
         action='store', type=int, dest='tcp_listeners_port')
@@ -167,7 +171,10 @@ def main():
     if options.daemonize:
         from daemon import DaemonContext
         #import lockfile
-        stderr = file('/var/log/ais/daemon.stderr', 'w+', 0664)
+        if options.log_stderr:
+            stderr = file('/var/log/ais/daemon.stderr', 'w+', 0664)
+        else:
+            stderr = None
         #pidfile = lockfile.FileLock('/var/run/ais/input.pid')
         with DaemonContext(stdout=stderr, stderr=stderr, umask=002):#, pidfile=pidfile):
             mainloop(options, args)