changeset 3109:4cd113328476

make logging not crash, more config samples
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Feb 2008 12:50:54 +0100
parents 2572688e031a
children a48929a5036c
files MoinMoin/server/__init__.py wiki/config/logging/logfile wiki/config/logging/stderr
diffstat 3 files changed, 37 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/server/__init__.py	Sat Feb 23 23:40:48 2008 +0100
+++ b/MoinMoin/server/__init__.py	Sun Feb 24 12:50:54 2008 +0100
@@ -14,10 +14,10 @@
 from MoinMoin import config
 
 import logging as _logging
+from logging.config import fileConfig as _fileConfig
 
 def configureLogging(conf, defaults):
-   from logging.config import fileConfig
-   fileConfig(StringIO(conf), defaults)
+   _fileConfig(StringIO(conf), defaults)
 
 def getLogger(name):
     # do we want to strip MoinMoin. from the name?
@@ -80,7 +80,7 @@
     # anything else, override logging_conf in your server script's Config class.
     logging_defaults = {
         'logdir': '.',
-        'loglevel': 'DEBUG',
+        'loglevel': 'INFO',
 }
     logging_config = """\
 [loggers]
@@ -97,7 +97,7 @@
 handlers=logfile
 
 [handler_logfile]
-class=StreamHandler
+class=FileHandler
 level=NOTSET
 formatter=logfile
 args=('%(logdir)s/moin.log', 'at')
--- a/wiki/config/logging/logfile	Sat Feb 23 23:40:48 2008 +0100
+++ b/wiki/config/logging/logfile	Sun Feb 24 12:50:54 2008 +0100
@@ -3,7 +3,7 @@
         # Make sure the running moin process has create/write rights there.
         'logdir': '/path/to/logdir',
         # Default loglevel, to adjust verbosity: DEBUG, INFO, WARNING, ERROR, CRITICAL
-        'loglevel': 'DEBUG',
+        'loglevel': 'INFO',
     }
     logging_config = """\
 [loggers]
@@ -20,7 +20,7 @@
 handlers=logfile
 
 [handler_logfile]
-class=StreamHandler
+class=FileHandler
 formatter=logfile
 level=%(loglevel)s
 args=('%(logdir)s/moin.log', 'at')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wiki/config/logging/stderr	Sun Feb 24 12:50:54 2008 +0100
@@ -0,0 +1,31 @@
+    logging_defaults = {
+        # Default loglevel, to adjust verbosity: DEBUG, INFO, WARNING, ERROR, CRITICAL
+        'loglevel': 'INFO',
+    }
+    logging_config = """\
+[loggers]
+keys=root
+
+[handlers]
+keys=stderr
+
+[formatters]
+keys=screen
+
+[logger_root]
+level=NOTSET
+handlers=stderr
+
+[handler_stderr]
+class=StreamHandler
+formatter=screen
+level=%(loglevel)s
+args=(sys.stderr, )
+
+[formatter_screen]
+format=%(asctime)s %(name)s %(levelname)s %(message)s
+datefmt=
+class=logging.Formatter
+"""
+
+