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

cl at isbd.net cl at isbd.net
Sat Jun 4 08:14:33 EDT 2016


Ben Finney <ben+python at benfinney.id.au> wrote:
> 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?
> 
Very true, I thought the code was going to be much longer than that.
:-)

... and the answer is, yes, with the above I just get the message text
which is what I want.

-- 
Chris Green
·


More information about the Python-list mailing list