Skip to content

Instantly share code, notes, and snippets.

@alikins
Created September 15, 2020 15:35
Show Gist options
  • Save alikins/402936522de508f105771c982759f83b to your computer and use it in GitHub Desktop.
Save alikins/402936522de508f105771c982759f83b to your computer and use it in GitHub Desktop.
kind of excessive logging config
---
version: 1
disable_existing_loggers: false
# disable_existing_loggers: true
dynaconf_merge: true
filters:
require_debug_true:
(): django.utils.log.RequireDebugTrue
sql_excludes:
(): alogging.filters.django_sql_excludes.DjangoDbSqlExcludeFilter
excludes:
- core_contentappstatus
- last_heartbeat
default_fields:
(): alogging.filters.default_fields.DefaultFieldsFilter
defaults:
request:
user: ""
session:
_session: {}
status_code: ""
# correlation:
# (): cid.log.CidContextFilter
formatters:
simple:
format: "{levelname} {message}"
style: "{"
verbose:
format:
"{levelname} {asctime} {status_code} user={request.user} session={request.session._session} {name} {module}:{funcName}:{lineno:d} {process:d}
{thread:d} {message}"
style: "{"
color:
'()': color_bucket_logger.ColorFormatter
# format:
# "{levelname} {asctime} {status_code} user={request.user} {name} {module}.{funcName}:{lineno:d} {process:5}
# {thread:d} {message}"
format:
"{levelname} {asctime} {name} {module}.{funcName}:{lineno:d} {process:5} {message}"
style: "{"
auto_color: true
color_groups:
- ['name', ['name', 'default', 'funcName', 'lineno', 'module']]
- ['process', ['process', 'processName']]
- ['thread', ['thread', 'threadName']]
- ['levelname', ['levelname']]
sql_verbose:
format:
"{levelname} {asctime} {name} {module}:{funcName}:{lineno:d} {process:d} {thread:d} {message}\n## BEGIN ##\n{sql}\n## PARAMS ##\n{params}\n## END ##'"
style: "{"
sql_color_formatted:
'()': alogging.formatters.django_sql_color.DjangoDbSqlColorFormatter
format:
"{levelname} {asctime} {name} {module}:{funcName}:{lineno:d} {process:d} {thread:d} {message}\n## BEGIN ##\n{sql}\n## PARAMS ##\n{params}\n## END ##'"
style: "{"
options:
reindent: true
# reindent_aligned: true
keyword_case: 'upper'
# indent_columns: true
# pygments_formatter_style_name: 'solarized-dark'
pygments_style: 'colorful'
pygments_formatter: 'terminal256'
pygments_lexer: 'postgres'
sql_formatted:
'()': alogging.formatters.django_sql.DjangoDbSqlFormatter
format:
"{levelname} {asctime} {name} {module}:{funcName}:{lineno:d} {process:d} {thread:d} {message}\n## BEGIN ##\n{sql}\n## PARAMS ##\n{params}\n## END ##'"
style: "{"
options:
reindent: true
# reindent_aligned: true
keyword_case: 'upper'
# indent_columns: true
handlers:
console:
class: logging.StreamHandler
# formatter: verbose
formatter: color
level: DEBUG
filters:
- default_fields
sql_console:
class: logging.StreamHandler
formatter: sql_color_formatted
filters:
- sql_excludes
level: DEBUG
collection_import:
class: pulp_ansible.app.logutils.CollectionImportHandler
level: DEBUG
formatter: simple
loggers:
"":
handlers:
- console
level: DEBUG
django:
level: DEBUG
# propagate: true
django.server:
level: DEBUG
# propagate: true
django.db:
handlers:
- sql_console
# level: DEBUG
level: INFO
propagate: false
django.request:
# handlers:
# - console
level: INFO
# propagate: false
django.security:
level: DEBUG
propagate: true
django.security.csrf:
level: DEBUG
propagate: true
# something about the way the django/drf/pulp/gng do
# url resolving makes any 404 dump about 20 stack traces
# if django.template is DEBUG
django.template:
level: INFO
django.utils.autoreload:
# level: ERROR
level: INFO
dynaconf:
# handlers:
# - console
level: DEBUG
galaxy_ng:
level: DEBUG
galaxy_ng.auth:
level: DEBUG
galaxy_pulp:
level: DEBUG
pulpcore:
# handlers:
# - console
level: DEBUG
pulpcore.content:
level: INFO
pulpcore.tasking.services.worker_watcher:
level: INFO
pulp_ansible:
level: DEBUG
pulp_ansible.app.tasks.collection.import_collection:
level: INFO
handlers:
- collection_import
propagate: false
requests:
# requests sets a NullHandler by default
handlers:
- console
level: DEBUG
rq:
level: INFO
urllib3:
handlers:
- console
level: DEBUG
# drf_yasg: {}
django_filters:
level: DEBUG
import_export:
level: INFO
import_export.resources:
level: INFO
gnupg:
handlers:
- console
gunicorn:
# handlers:
# - console
level: INFO
# stuff not useful for DEBUG
MARKDOWN:
level: INFO
aiohttp:
level: INFO
asyncio:
level: INFO
# Used by django_extensions shell_plus with ptpython
parso:
level: INFO
+import os
+import yaml
+PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
+logging_config = yaml.safe_load(open(os.path.join(PROJECT_DIR, 'logging.yaml'), 'r'))
+LOGGING = logging_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment