Python Logging in Sanic Library

Python Logging in Sanic Library


In the previous article we talked about how we can configure our application using Sanic Library. If you have not checked the previous article please check it using the following link

In this article we are going to talk about how to log the information while you are running an applications using Sanic Library.


Logging is a means using which we can keep track of information while an application is running. It is a very useful information for software developers and can be helpful during Debugging.

In Sanic you can use different types of logging like Access log or Error log using the python3 logging API.

If you have saved your file as then run the application using the command
You will see the following information.

Go to in your browser to send a request to server then in your command line you can view your log information like the example given below.

Configuring your Log:

If we have our own log configuration then we can use log_config parameter when we initialize Sanic app.


In this article we saw how we can see logging information of our applications. We also learnt how to configure the log information. In further articles we will introduce more exciting features of Sanic Library.
Please look forward to other articles on Sanic.