Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28098
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2012-08-30 03:38 -0700 |
| Message-ID | <97b8c5f2-eaa9-456a-b766-146ac65b879e@googlegroups.com> (permalink) |
| Subject | Python Logging: Specifying converter attribute of a log formatter in config file |
| From | srimanthula.radhakrishna@gmail.com |
I'd like to have all timestamps in my log file to be UTC timestamp. When specified through code, this is done as follows:
myHandler = logging.FileHandler('mylogfile.log', 'a')
formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(name)-15s:%(lineno)4s: %(message)-80s')
formatter.converter = time.gmtime
myLogger = logging.getLogger('MyApp')
myLogger.addHandler(myHandler)
I'd like to move away from the above 'in-code' configuration to a config file based mechanism.
Here's the config file section for the formatter:
[handler_MyLogHandler]
args=("mylogfile.log", "a",)
class=FileHandler
level=DEBUG
formatter=simpleFormatter
Now, how do I specify the converter attribute (time.gmtime) in the above section?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Python Logging: Specifying converter attribute of a log formatter in config file srimanthula.radhakrishna@gmail.com - 2012-08-30 03:38 -0700 Re: Python Logging: Specifying converter attribute of a log formatter in config file Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-09-16 01:07 -0700
csiph-web