Browse Source

[1190] Init logging in msgq

Using some hardcoded values for file and severity. This is a temporary
solution, and we should improve on that, but currently it is not
possible to get the configuration in msgq (even though the msgq is used
to send it everywhere else).
Michal 'vorner' Vaner 12 years ago
parent
commit
b40cd6851a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/bin/msgq/msgq.py.in

+ 11 - 0
src/bin/msgq/msgq.py.in

@@ -31,6 +31,7 @@ import select
 import random
 from optparse import OptionParser, OptionValueError
 import isc.util.process
+import isc.log
 
 import isc.cc
 
@@ -563,6 +564,16 @@ if __name__ == "__main__":
                       help="UNIX domain socket file the msgq daemon will use")
     (options, args) = parser.parse_args()
 
+    # Init logging, according to the parameters.
+    # FIXME: Do proper logger configuration, this is just a hack
+    sev = 'INFO'
+    if options.verbose:
+        sev = 'DEBUG'
+    LOG_FILE = os.path.join("@localstatedir@", "@PACKAGE_NAME@",
+                            "msgq.log").replace("${prefix}", "@prefix@")
+    isc.log.init("b10-msgq", buffer=False, severity=sev, debuglevel=99,
+                 file=LOG_FILE)
+
     signal.signal(signal.SIGTERM, signal_handler)
 
     # Announce startup.