

{"id":72573,"date":"2019-11-14T16:05:56","date_gmt":"2019-11-14T10:35:56","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=72573"},"modified":"2021-06-21T12:19:14","modified_gmt":"2021-06-21T06:49:14","slug":"django-logging","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/django-logging\/","title":{"rendered":"Django Logging &#8211; The Most Easy Method to Perform it!"},"content":{"rendered":"<p>All developers debug errors. The resolving of those errors takes time. It helps in most cases to know when and where the error occurred. I would say that Python\u2019s error messages are quite helpful. But even these messages render useless when talking about projects with multiple files.<\/p>\n<p>That problem and many other benefits come with logging.<\/p>\n<p>As Django developers, it is important that we also master logging. Backend technologies have various great tools to implement logging. Django too provides support for various logging frameworks and modules. We will implement it using the basic and one of the popular, <strong>logging module<\/strong>.<\/p>\n<p>In this tutorial, we will learn about logging. The contents will be:<\/p>\n<ul>\n<li>What is Logging?<\/li>\n<li>Python Logging Module<\/li>\n<li>Logging in Django<\/li>\n<\/ul>\n<p>Ready to learn. Let\u2019s get started.<\/p>\n<h4>What is Logging?<\/h4>\n<p>Logging is a technique or medium which can let us track some events as the software executes. It is an important technique for developers. It helps them to track events. Logging is like an extra set of eyes for them. Developers are not only responsible for making software but also for maintaining them.<\/p>\n<p>Logging helps with that part of maintenance immensely.<\/p>\n<p>It tracks every event that occurs at all times. That means instead of the long tracebacks you get much more. This time when an error occurs you can see in which the system was. This method will help you resolve errors quickly. As you will be able to tell where the error occurred.<\/p>\n<p><strong>How does it work? What\u2019s the idea behind it?<\/strong><\/p>\n<p>The logging is handled by a separate program. That logging program is simply a file-writer. The logger is said to record certain events in text format. The recorded information is then saved in files. The files for this are called logs.<\/p>\n<p>The logs are simple files saved with log extension. They contain the logs of events occurred.<\/p>\n<p>Well, this is just one of the most used implementations, as you can see. Since we are just storing the information, you can come up with more ways to deal with it.<\/p>\n<p>Okay, it\u2019s clear to us that logging is important. Is it difficult? No absolutely not buddy. Logging is not difficult at all. Anyone who knows a little bit about the setup can use this.<\/p>\n<p>Being a Python programmer, you get extra features here too. We got a whole module that lets us accomplish just that. As for other languages, there are many modules, Java has Log4j and <em><strong>JavaScript<\/strong><\/em> has its own loglevel. All these are amazing tools as well.<\/p>\n<p>Okay, so we will be dealing with Python (my favorite Language) here.<\/p>\n<h4>Logging Module in Python<\/h4>\n<p>The logging module is a built-in Python module. It comes preinstalled with Python 3. Logging module is used to keep track of the events that occur as the program runs. That can be extended to any number of programs and thus for software, it is easy to set up and use.<\/p>\n<h4>Why use logging module?<\/h4>\n<p>As a developer, we can ask why use the logging module. All logging does is writing to a file or printing it on the console. All that can be achieved by using print statements. Then what is the need for a logging module?. That\u2019s a valid question. The answer to that is logging is a module that gives what print cannot.<\/p>\n<p>We use print function to output something on console. So, when a function occurs, we can get a print statement that the function executed. While that approach works with smaller applications, it is inefficient.<\/p>\n<p>Print function becomes part of your program and if the software stops working, you won\u2019t get the result. Also, if anything occurs and system restarts, the console is also clear. So, what will you do then? The answer to that is logging module.<\/p>\n<p>The logging module is capable of:<\/p>\n<ul>\n<li>Multithreading execution<\/li>\n<li>Categorizing Messages via different log levels<\/li>\n<li>It&#8217;s much more flexible and configurable<\/li>\n<li>Gives a more structured information<\/li>\n<\/ul>\n<p>So, there are 4 main parts of logging module. We will look at them one by one.<\/p>\n<h4>1. Loggers<\/h4>\n<p>The loggers are the objects that developers deal with. They can be understood as a function which will be invoked when they are called. We use loggers in our project files. Thus, when the function is invoked, we get a detailed report. The logger can generate multiple levels of responses.<\/p>\n<p>We can customize it to full extent.<\/p>\n<h4>2. Handlers<\/h4>\n<p>Handlers are the objects which emit the information. Think of them as newspaper handlers. Their main task is to transmit the information. That can be achieved by writing the info in a log file (The default behaviour). There are various handlers provided by logging module.<\/p>\n<p>We can easily set-up multiple handlers for the same logger. There are SMTP Handlers too which will mail the log records to you. The handlers usually contain business logic for logging information.<\/p>\n<h4>3. Formatters<\/h4>\n<p>The formatters are the ones which format the data. You see handlers cannot send the information as it\u2019s a <em><strong>Python data type<\/strong><\/em>. Before it can be sent to anyone, it needs to be converted.<\/p>\n<p>The logs are by-default in Log Records format. That is the class pre-defined by logging framework. It gives various methods to developers to use. That format can not be directly sent over a network or written in a text file. To convert that or format that, we need formatters.<\/p>\n<p>There are different formatters for different handlers.<\/p>\n<p>By default, the formatters will convert the Log Record into String. This behaviour can be easily changed and you can customize this as you want. This format can be based on the business logic that we write in Handlers.<\/p>\n<h4>4. Filters<\/h4>\n<p>The last piece of the logging module is filters. The filters, as the name suggests, filter the messages. Not every message we pass needs to be stored or transported. Or there can be different handlers for different messages. All that is achievable with the help of filters.<\/p>\n<p>We can use filters with both loggers and handlers.<\/p>\n<p>Okay, so now we have got a basic idea of the logging module. It also provides us with message levels. The message levels are defined as:<\/p>\n<p><strong>DEBUG:<\/strong> It is verbose system information when everything is running fine. It will tell you more precise details about the state of the system. Its severity point is 10.<\/p>\n<p><strong>INFO:<\/strong> The info will produce less verbose system information but is similar to debug. It generally tells an overview of what the system is executing. Its severity point is 20.<\/p>\n<p><strong>WARNING:<\/strong> This contains information regarding low-level problems. The problems may be ignored as they don\u2019t cause the system to halt. Although, it is recommended that these problems shall be resolved.<\/p>\n<p>Its severity point is 30.<\/p>\n<p><strong>ERROR:<\/strong> This message is serious. The error will contain information about the major problem that has occurred. The problem may have stopped the operation of program and needs immediate attention.<\/p>\n<p>Its severity point is 40.<\/p>\n<p><strong>CRITICAL:<\/strong> The most critical message. This message is emitted when the problem has caused the system to stop. That means the whole application has halted due to this problem.<\/p>\n<p>Its severity point is 50.<\/p>\n<p>The severity point determines what priority shall be given. Suppose, we set the log level to be 30. Then the logger will log or store the information when the level is greater than or equal to 30. So, you just need to confirm what level of logging you want. We will learn more about them in the further section.<\/p>\n<p>We can easily implement logging by importing the module. Since it\u2019s a built-in module, we need not install it via pip.<\/p>\n<p>Just write this in your<em> <strong>Python file<\/strong> <\/em>and we can use loggers.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import logging\r\nlogging.warning(\"DataFlair Logging Tutorials\")<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72580\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output.png\" alt=\"import logging output - Django Logging\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/import-logging-output-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>The output generated by the code is right below. As you can see, the log is printed on the console, it has<strong> log-level<\/strong>, <strong>logger-name<\/strong> and <strong>message<\/strong>. <strong>root<\/strong> is the default<strong> logger-name<\/strong>. We will use these kinds of functions with our views in Django.<\/p>\n<h4>Logging in Django<\/h4>\n<p>Django provides logging by using the logging module of Python. The logging module can be easily configured.<\/p>\n<p>When we want to use logging in Django there are certain steps to be followed. The procedure will be as follows:<\/p>\n<ol>\n<li>We will configure our settings.py for various loggers, handlers, filters.<\/li>\n<li>We will include the loggers code in views or any other module of Django where necessary.<\/li>\n<\/ol>\n<p>Okay, so let\u2019s get started.<\/p>\n<h3>Create a new Project<\/h3>\n<p>We will create a new project for logging. You can then use the logging in existing projects. So, to create a new project, execute this command in the command line:<\/p>\n<p><em><strong>$ django-admin startproject dataflairlogs<\/strong><\/em><\/p>\n<p>This will start the new project. Now, we will configure settings.py of the project.<\/p>\n<h3>Configuring Settings<\/h3>\n<p>For including logging in Django, we need to configure its settings. Doing that is pretty easy. By configuring logging settings, we mean to define:<\/p>\n<ul>\n<li>Loggers<\/li>\n<li>Handlers<\/li>\n<li>Filters<\/li>\n<li>Formatters<\/li>\n<\/ul>\n<p>Since Django works with different modules therefore, we use the <strong>dictConfig<\/strong> method. There are other raw methods as well, but <strong>dictConfig<\/strong> is what Django\u2019s default behavior. Just copy this code in your settings.py<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># DataFlair #Logging Information\r\nLOGGING = {\r\n    'version': 1,\r\n    # Version of logging\r\n    'disable_existing_loggers': False,\r\n    #disable logging \r\n    # Handlers #############################################################\r\n    'handlers': {\r\n        'file': {\r\n            'level': 'DEBUG',\r\n            'class': 'logging.FileHandler',\r\n            'filename': 'dataflair-debug.log',\r\n        },\r\n########################################################################\r\n        'console': {\r\n            'class': 'logging.StreamHandler',\r\n        },\r\n    },\r\n    # Loggers ####################################################################\r\n    'loggers': {\r\n        'django': {\r\n            'handlers': ['file', 'console'],\r\n            'level': 'DEBUG',\r\n            'propagate': True,\r\n            'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG')\r\n        },\r\n    },\r\n}<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72581\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py.png\" alt=\"settings.py - Django Logging\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/settings-py-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understand the Code:<\/strong><\/p>\n<p>I know the code is a bit large but it\u2019s very easy to grasp. We get a built-in variable <strong>LOGGING<\/strong> from Django. The logging\u2019s default values come from this dictionary. Since we are configuring settings using a dictionary it\u2019s called the\u00a0<strong>dictConfig<\/strong> method.<\/p>\n<p>There are some important keys inside the <strong>LOGGING<\/strong> dictionary.<\/p>\n<ol>\n<li>version<\/li>\n<li>disable_existing_loggers<\/li>\n<li>handlers<\/li>\n<li>loggers<\/li>\n<\/ol>\n<p>Let\u2019s discuss them one by one. The <strong>version<\/strong> key tells the schema version. It&#8217;s important that it has value. It\u2019s by default 1.<\/p>\n<p>The next key is <strong>disable_existing_loggers<\/strong>. This key is to tell Django to do not disable loggers. By default, Django uses some of its own loggers. These loggers are connected with <em><strong>Django ORM<\/strong><\/em> and other inner parts of Django. This key is by default <strong>True<\/strong>. So, it will disable those loggers.<\/p>\n<p>There are various database queries and function calls which the loggers log. Therefore, it is recommended that you don\u2019t True this Key.<\/p>\n<p><strong>Handlers<\/strong> is the 3rd key. As we discussed, handlers handle the message and pass them to console, file, etc. The handlers itself is a dictionary. That dictionary-key names will be the names of the handlers. There are various handlers provided by the logging module. We are using two handlers here.<\/p>\n<p>1. <strong>FileHandler<\/strong>: logger-name &#8211; <strong>filehandler<\/strong><\/p>\n<p>The FileHandler will store the logs in a file. As you can see, we have given the filename as <strong>dataflair-debug.log<\/strong>. The <strong>level<\/strong> defines, until what level the logger shall commit logs.<\/p>\n<p><strong>Note:<\/strong><\/p>\n<p>Log files are generally stored with .log extension. This file can only be edited with permissions. It can only be appended.<\/p>\n<p>2. <strong>StreamHandler<\/strong>: logger name &#8211; <strong>console<\/strong><\/p>\n<p>The stream handler will stream the log on console. This is not a recommended method. There is a limit of characters until the command line shows you logs. Since logs are too big to handle by command line therefore we need file-handlers.<\/p>\n<p>There are more handlers like mailhandlers, AdminEmailHandler etc.<\/p>\n<p>The AdminEmailHandler is a great addition to the opensource module.<\/p>\n<p><strong>Loggers<\/strong> are the ones that will log your server or software information. Loggers are also a dictionary type. It has a similar architecture as <strong>handlers<\/strong>. Although, there are different attributes and other properties.<\/p>\n<p>Django also provides a set of loggers. There are various loggers like <strong>django, django.requests.<\/strong> and more.<\/p>\n<p>Now, to implement logging, you just need to follow these steps:<\/p>\n<p>Start your server.<\/p>\n<p><em><strong>$ python manage.py runserver<\/strong><\/em><\/p>\n<p>The moment you hit enter there will be a series of logs and a lot of that. This happened because we set the default level to debug. All these logs are actually messages from the default loggers.<\/p>\n<p>You can create your custom loggers in the consecutive files. That way you can get logs from specific files.<\/p>\n<p>Here is the output of the file which is generated after logging.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72582\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs.png\" alt=\"logs - Django Logging\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/logs-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>These are the logs. There are a lot of logs but only warning or above levels shall be notified.<\/p>\n<h4>Summary<\/h4>\n<p>Logging is pretty important. If it\u2019s implemented correctly, then it can save you a lot of time. Generally, logging is done after the project is complete.<\/p>\n<p>Logging module is the basics of logging with Django or another python project. There are other solutions as well like, celery, travis etc. These log handlers also make it easy to handle logs. They can ease the task of searching whether the events occurred or not and what was the cause.<\/p>\n<p><em>Any queries related to Django Logging article? Mention through comments<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>All developers debug errors. The resolving of those errors takes time. It helps in most cases to know when and where the error occurred. I would say that Python\u2019s error messages are quite helpful.&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":72855,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19149],"tags":[21425,21424,21427,21426,10661],"class_list":["post-72573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","tag-django-log-file","tag-django-logging","tag-django-logging-best-practices","tag-django-logging-config","tag-python-logging-module"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Django Logging - The Most Easy Method to Perform it! - DataFlair<\/title>\n<meta name=\"description\" content=\"Django Logging Tutorial - Learn about Python logging module with its parts &amp; filters &amp; steps for logging in Django by creating a new project &amp; using handlers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/django-logging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Django Logging - The Most Easy Method to Perform it! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Django Logging Tutorial - Learn about Python logging module with its parts &amp; filters &amp; steps for logging in Django by creating a new project &amp; using handlers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/django-logging\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-14T10:35:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-21T06:49:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Django Logging - The Most Easy Method to Perform it! - DataFlair","description":"Django Logging Tutorial - Learn about Python logging module with its parts & filters & steps for logging in Django by creating a new project & using handlers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/django-logging\/","og_locale":"en_US","og_type":"article","og_title":"Django Logging - The Most Easy Method to Perform it! - DataFlair","og_description":"Django Logging Tutorial - Learn about Python logging module with its parts & filters & steps for logging in Django by creating a new project & using handlers.","og_url":"https:\/\/data-flair.training\/blogs\/django-logging\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-11-14T10:35:56+00:00","article_modified_time":"2021-06-21T06:49:14+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Django Logging &#8211; The Most Easy Method to Perform it!","datePublished":"2019-11-14T10:35:56+00:00","dateModified":"2021-06-21T06:49:14+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/"},"wordCount":2105,"commentCount":4,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg","keywords":["django log file","Django Logging","django logging best practices","django logging config","Python Logging module"],"articleSection":["Django Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/django-logging\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/django-logging\/","url":"https:\/\/data-flair.training\/blogs\/django-logging\/","name":"Django Logging - The Most Easy Method to Perform it! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg","datePublished":"2019-11-14T10:35:56+00:00","dateModified":"2021-06-21T06:49:14+00:00","description":"Django Logging Tutorial - Learn about Python logging module with its parts & filters & steps for logging in Django by creating a new project & using handlers.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/django-logging\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-logging-tutorial.jpg","width":802,"height":420,"caption":"django logging tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/django-logging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Django Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/django\/"},{"@type":"ListItem","position":3,"name":"Django Logging &#8211; The Most Easy Method to Perform it!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/72573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=72573"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/72573\/revisions"}],"predecessor-version":[{"id":97540,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/72573\/revisions\/97540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/72855"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=72573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=72573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=72573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}