main: Add the logger name and process ID to the syslog formatter
authorW. Trevor King <wking@tremily.us>
Fri, 21 Feb 2014 02:35:08 +0000 (18:35 -0800)
committerW. Trevor King <wking@tremily.us>
Fri, 21 Feb 2014 02:35:08 +0000 (18:35 -0800)
When logging to stderr, there's no need to differentiate the logging
process.  When everything's landing in the same system log, there is.

package_cache/main.py

index 9daabdb3edb003aa54943d32ea92955e293efcf2..6d5895c75cbe113ab06c34fef9190b49f3f09e29 100644 (file)
@@ -82,6 +82,9 @@ def run(*args, **kwargs):
         handler = _logging_handlers.SysLogHandler(
             address='/dev/log', facility='daemon')
         _MAIN_LOG.addHandler(handler)
         handler = _logging_handlers.SysLogHandler(
             address='/dev/log', facility='daemon')
         _MAIN_LOG.addHandler(handler)
+        formatter = _logging.Formatter(
+            fmt='%(name)s[%(process)d]: %(message)s')
+        handler.setFormatter(formatter)
 
     server = _server.Server(sources=args.source or [], cache=args.cache)
     wsgi = _wsgiref_simple_server.make_server(
 
     server = _server.Server(sources=args.source or [], cache=args.cache)
     wsgi = _wsgiref_simple_server.make_server(