Python Logging and printf()
stephane at wirtel.be
Fri Nov 21 11:57:09 CET 2014
On 21 Nov 2014, at 11:48, Ganesh Pal wrote:
> Hi Team ,
> Iam using the python logging module to log the events for my
> into a log file .
> I have set the logging level to DEBUG as shown below
> format='%(asctime)s %(levelname)s:%(message)s',
> datefmt='%m/%d/%Y %I:%M:%S %p')
> iam also using logging.warning(),logging.error(),logging.info() etc
> and when required.
> Please provide your input on the below questions.
> (1). How do i guarantee that all console messages will be logged into
> logfile ?
There is no guarantee, it's a software. But all the log messages have to
be stored in the logfile
> (2) I feel the need to retain few print(), how do I ensure the
> messages are also logged into the log file.
the print function or print keyword don't use the logging module, you
need to use it.
Stéphane Wirtel - http://wirtel.be - @matrixise
More information about the Python-list