Python Logging Basic

Python Logging Basic

In this article we will learn to capture log in python application or script. When we execute program and get error without log it will be very difficult to trace.

How we can log in python.

Print is a bad practice for logging. if you writing a small script it might be fine to user print but I recommend not to use print statement for logging purpose.

What to use for python Logging? . Python provide a standard module named “logging“.

Let start with Python Logging basic.

When you run the above code log will be generated.

To know about the argument of logging.basicConfig: Click Here
Attribute for Format: Click Here

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *