annotate MoinMoin/log.py @ 3505:cd43bbf56c33

logging: removed logging to ./moin.log from fallback config, better docs
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Apr 2008 18:47:57 +0200
parents 71b403707c1d
children ff4afe930cb2
rev   line source
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - init "logging" system
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 WARNING
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 -------
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 logging must be configured VERY early, before any moin module calls
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 log.getLogger(). Because most modules call getLogger on the module
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 level, this basically means that MoinMoin.log must be imported first
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 and load_config must be called afterwards, before any other moin
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 module gets imported.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
13 Usage (for wiki server admins)
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
14 ------------------------------
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
15 Typically, your server adaptor script (e.g. moin.cgi) will have this:
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
16
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
17 from MoinMoin import log
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
18 log.load_config('wiki/config/logging/logfile') # XXX please fix this path!
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
19
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
20 You have to fix that path to use a logging configuration matching your
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
21 needs (we provide some examples in the path given there, it is relative to
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
22 the uncompressed moin distribution archive - if you use some moin package,
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
23 you maybe find it under /usr/share/moin/).
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
24 It is likely that you also have to edit the sample logging configurations
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
25 we provide (e.g. to fix the logfile location).
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
26
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
27 Usage (for developers)
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
28 ----------------------
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
29 If you write code for moin, do this at top of your module:
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 from MoinMoin import log
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 logging = log.getLogger(__name__)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 This will create a logger with 'MoinMoin.your.module' as name.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 The logger can optionally get configured in the logging configuration.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 If you don't configure it, some upperlevel logger (e.g. the root logger)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 will do the logging.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38
3165
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
39 @copyright: 2008 MoinMoin:ThomasWaldmann,
3204
aae4a2384804 whitespace fixes
Mikko Virkkil? <mvirkkil@cc.hut.fi>
parents: 3165
diff changeset
40 2007 MoinMoin:JohannesBerg
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 @license: GNU GPL, see COPYING for details.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42 """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 # This is the "last resort" fallback logging configuration for the case
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45 # that load_config() is either not called at all or with a non-working
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46 # logging configuration.
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47 # See http://www.python.org/doc/lib/logging-config-fileformat.html
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
48 # We just use stderr output by default, if you want anything else,
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
49 # you will have to configure logging.
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 logging_defaults = {
3487
71b403707c1d use INFO loglevel in fallback logging config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3204
diff changeset
51 'loglevel': 'INFO',
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 }
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 logging_config = """\
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 [loggers]
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 keys=root
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 [handlers]
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
58 keys=stderr
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 [formatters]
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
61 keys=default
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 [logger_root]
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64 level=%(loglevel)s
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
65 handlers=stderr
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 [handler_stderr]
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 class=StreamHandler
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 level=NOTSET
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
70 formatter=default
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 args=(sys.stderr, )
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72
3505
cd43bbf56c33 logging: removed logging to ./moin.log from fallback config, better docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3487
diff changeset
73 [formatter_default]
3112
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74 format=%(asctime)s %(levelname)s %(name)s:%(lineno)d %(message)s
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 datefmt=
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 class=logging.Formatter
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 import logging, logging.config
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 configured = False
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82 fallback_config = False
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 def load_config(conf_fname):
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 """ load logging config from conffile """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 global configured
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 try:
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 logging.config.fileConfig(conf_fname)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90 configured = True
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 except Exception, err: # XXX be more precise
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92 load_fallback_config(err)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 def load_fallback_config(err=None):
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 """ load builtin fallback logging config """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 global configured
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 from StringIO import StringIO
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 logging.config.fileConfig(StringIO(logging_config), logging_defaults)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 configured = True
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 l = getLogger(__name__)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 l.warning('Using built-in fallback logging configuration!')
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 if err:
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 l.warning('load_config failed with "%s".' % str(err))
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 def getLogger(name):
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 """ wrapper around logging.getLogger, so we can do some more stuff:
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 - preprocess logger name
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 - patch loglevel constants into logger object, so it can be used
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 instead of the logging module
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 """
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 if not configured: # should not happen
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 load_fallback_config()
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 logger = logging.getLogger(name)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 for levelnumber, levelname in logging._levelNames.items():
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 if isinstance(levelnumber, int): # that list has also the reverse mapping...
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117 setattr(logger, levelname, levelnumber)
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 return logger
dc182f4936b1 logging: add missing file for previous changeset 79f850129782)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119
3165
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
120
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
121 # Python 2.3's logging module has no .log, this provides it:
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
122 if not hasattr(logging, 'log'):
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
123 def log(level, msg, *args, **kwargs):
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
124 if len(logging.root.handlers) == 0:
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
125 logging.basicConfig()
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
126 if logging.root.manager.disable >= level:
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
127 return
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
128 if level >= logging.root.getEffectiveLevel():
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
129 logging.root._log(level, msg, args, **kwargs)
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
130 logging.log = log
b8dc6c2e6c53 integrate MoinMoin.support.logging_fix into MoinMoin.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3112
diff changeset
131