Python Tutorial: Logging Basics – Logging to Files, Setting Levels, and Formatting

///Python Tutorial: Logging Basics – Logging to Files, Setting Levels, and Formatting

Python Tutorial: Logging Basics – Logging to Files, Setting Levels, and Formatting

FavoriteLoadingAdd to favorites

In this Python Tutorial, we will be going over the basics of logging. We will learn how to switch out our print statements for logs, change the logging level, add logs to files, and also how to change the format of those logs. Let’s get started.

Advanced Logging Video – https://youtu.be/jxmzY9soFXg

The code from this video can be found at:
https://github.com/CoreyMSchafer/code_snippets/tree/master/Logging-Basics

If you enjoy these videos and would like to support my channel, I would greatly appreciate any assistance through my Patreon account:
https://www.patreon.com/coreyms

Or a one-time contribution through PayPal:
https://goo.gl/649HFY

If you would like to see additional ways in which you can support the channel, you can check out my support page:

You can find me on:
My website – http://coreyms.com/
Facebook – https://www.facebook.com/CoreyMSchafer
Twitter – https://twitter.com/CoreyMSchafer
Google Plus – https://plus.google.com/+CoreySchafer44/posts
Tumblr – https://www.tumblr.com/blog/mycms

By |2017-05-01T12:23:17+00:00April 26th, 2017|Programming Video Tutorials, Python Video Tutorials|20 Comments

20 Comments

  1. Suman Banerjee April 26, 2017 at 9:10 pm - Reply

    HI Corey, Please make a tutorial on pyqtgraph.

  2. Shubham Aggarwal April 26, 2017 at 9:26 pm - Reply

    Corey, please make a video on Coroutines and asyncio also !

  3. alphastrata April 26, 2017 at 9:26 pm - Reply

    welcome back mate 🙂

  4. Zwork101 April 26, 2017 at 9:29 pm - Reply

    Before I watched this video, I had my program take this kind of information and append it to a file, is it worth to make the switch?

  5. Richard Beddoes April 26, 2017 at 9:31 pm - Reply

    wanted to adding some logging features to a project I’ve been working on. this video could not have been created at a better time! thanks

  6. Mike G April 26, 2017 at 9:33 pm - Reply

    I couldn’t find anything built in that would log how long the function took to execute. You would think that would be built in.

  7. SciFi555 April 26, 2017 at 9:35 pm - Reply

    Just when I start learning logging in Python this pops-up. Thanks Corey.

  8. Odesto Polanco April 26, 2017 at 9:36 pm - Reply

    Congrats man, you maje greats tutorials. keep the great work

  9. Snapchat Dotcom April 26, 2017 at 9:36 pm - Reply

    yo bro, how did you do that when you typed in 4 lines simultaneously !

  10. Andrew Sauerwin April 26, 2017 at 9:38 pm - Reply

    Corey! Which version of Python are you using?

    I am trying to mimic the same process above in this video for the basicConfig change in the level for debug. Once I use the same line of code, and change the logging.warning to debug, it won’t print to the console. Though prior to the change in the lever of severity, it will print Warning based on the default. I am currently using 2.7.

  11. FireSpark April 26, 2017 at 9:41 pm - Reply

    Can you please post a code how to solve cubic equation with Python? would be rly cool!!

  12. Srineesh Salur April 26, 2017 at 9:44 pm - Reply

    Exactly the time i needed it when iam halfway in the decorators vedio and scratching my head on logging

  13. khawar abbasi April 26, 2017 at 9:47 pm - Reply

    Thanks Corey for making such a nice videos. I am anxiously waiting for your python videos on REST api, test cases and debugging (e.g. how to debugg python complex class using interactive shell, etc.)

  14. Abdul Rahman Malik April 26, 2017 at 9:52 pm - Reply

    Brilliant!

  15. lies damnlies April 26, 2017 at 10:00 pm - Reply

    Oh thank fuck for these videos. Python’s logging documentation is a real headache to get through. >.<

  16. geoffgivry April 26, 2017 at 10:00 pm - Reply

    Thanks a lot Corey, you truly are a great teacher and definitely my favorite python YouTube channel!

  17. Ray Torres April 26, 2017 at 10:01 pm - Reply

    thanks a lot for a good tutorial.

  18. Eric Tai April 26, 2017 at 10:02 pm - Reply

    so helpful thanks!

  19. CBorgZ April 26, 2017 at 10:06 pm - Reply

    I like in American specialists that they are able to briefly and clearly state their thoughts.
    In Russia, we do not have such "clearly thinking" teachers.
    And therefore we are behind at everything technology levels. And It’s sad.
    *Thanks a lot, man!*

  20. Amaretto April 26, 2017 at 10:08 pm - Reply

    Thank you very much for the great video!
    Two days ago i read the ebook "I Heart Logs" on allitebooks: http://bit.ly/2n01bT4
    Best regards from Germany

Leave A Comment

*