logging.basicConfig and log_request

153 views
Skip to first unread message

Miki Tebeka

unread,
Jan 31, 2012, 12:50:16 PM1/31/12
to python-...@googlegroups.com
Hello,

I've configured logging with:
    
    import logging as log
    log.basicConfig(
        format='[%(asctime)s] %(levelname)s:%(filename)s:%(funcName)s: %(msg)s',
        level=log.INFO)

However the output of the default log_request looks bad now:

    [2012-01-31 09:42:27,830] INFO:web.py:log_request: %d %s %.2fms
    [2012-01-31 09:43:04,360] INFO:web.py:log_request: %d %s %.2fms

Is this a bug or am I doing something wrong?

Thanks,
--
Miki

Ben Darnell

unread,
Jan 31, 2012, 1:04:39 PM1/31/12
to python-...@googlegroups.com
Use %(message)s instead of %(msg)s. In a log formatter, %(msg)s is
the raw format string and %(message)s is the string after
substitutions have been made.

-Ben

Miki Tebeka

unread,
Jan 31, 2012, 5:45:03 PM1/31/12
to python-...@googlegroups.com
Works like a charm. Thank you very much!
Reply all
Reply to author
Forward
0 new messages