]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update LOGGING example taken from Django docs. (#114903)
authorMariusz Felisiak <felisiak.mariusz@gmail.com>
Sat, 3 Feb 2024 07:37:21 +0000 (08:37 +0100)
committerGitHub <noreply@github.com>
Sat, 3 Feb 2024 07:37:21 +0000 (09:37 +0200)
For example, Django no longer provides a custom NullHandler

https://github.com/django/django/commit/6c66a41c3dc697dc3bda4e31e8b05084d2ede915

* Remove require_debug_true.

Doc/howto/logging-cookbook.rst

index ea494f2fdbbce42dbfd4531f7c0ed1da4a400342..80147e31fcbae115171abacc9b3a637d534d0ae4 100644 (file)
@@ -1933,30 +1933,28 @@ This dictionary is passed to :func:`~config.dictConfig` to put the configuration
 
     LOGGING = {
         'version': 1,
-        'disable_existing_loggers': True,
+        'disable_existing_loggers': False,
         'formatters': {
             'verbose': {
-                'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
+                'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
+                'style': '{',
             },
             'simple': {
-                'format': '%(levelname)s %(message)s'
+                'format': '{levelname} {message}',
+                'style': '{',
             },
         },
         'filters': {
             'special': {
                 '()': 'project.logging.SpecialFilter',
                 'foo': 'bar',
-            }
+            },
         },
         'handlers': {
-            'null': {
-                'level':'DEBUG',
-                'class':'django.utils.log.NullHandler',
-            },
-            'console':{
-                'level':'DEBUG',
-                'class':'logging.StreamHandler',
-                'formatter': 'simple'
+            'console': {
+                'level': 'INFO',
+                'class': 'logging.StreamHandler',
+                'formatter': 'simple',
             },
             'mail_admins': {
                 'level': 'ERROR',
@@ -1966,9 +1964,8 @@ This dictionary is passed to :func:`~config.dictConfig` to put the configuration
         },
         'loggers': {
             'django': {
-                'handlers':['null'],
+                'handlers': ['console'],
                 'propagate': True,
-                'level':'INFO',
             },
             'django.request': {
                 'handlers': ['mail_admins'],