Is there any way to use the logging module adding nothing to a message

Ben Finney ben+python at benfinney.id.au
Sat Jun 4 07:55:47 EDT 2016


cl at isbd.net writes:

> If I do:-
>
>     f = logging.handlers.RotatingFileHandler("/home/chris/tmp/mail.log", 'a', 1000000, 4)
>     f.setLevel(logging.DEBUG)
>     formatter = logging.Formatter('%(message)s')
>     f.setFormatter(formatter)
>     log.addHandler(f)
>
> Will I get just the message with no extras added by the logging module?

Yuo have the code, and presumably the system on which to test it. What's
the answer?

-- 
 \      “I am too firm in my consciousness of the marvelous to be ever |
  `\       fascinated by the mere supernatural …” —Joseph Conrad, _The |
_o__)                                                     Shadow-Line_ |
Ben Finney




More information about the Python-list mailing list