Python Logging and printf()

Ganesh Pal ganesh1pal at gmail.com
Fri Nov 21 11:48:03 CET 2014


Hi Team ,

Iam using the python logging module to log the events for my application
into a log file .

I have set the logging level to DEBUG  as shown below

logging.basicConfig(filename=options.log_file,
                        level=logging.DEBUG,
                        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  as
and when required.

Please provide your input on the below questions.

(1). How do i guarantee that  all console messages will be logged into the
logfile ?
(2) I feel the  need to retain few print(), how do I ensure the print()
messages are also logged into the log file.



Regards,
Ganesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141121/136d5543/attachment.html>


More information about the Python-list mailing list