-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgunicorn_log.conf
42 lines (34 loc) · 1.06 KB
/
gunicorn_log.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[loggers]
keys=root, gunicorn.error
[handlers]
keys=passthrough, gunicorn_error
[formatters]
keys=passthrough, json
# Add a custom handler for gunicorn_error logs, format them as structured JSON
# This includes info level logs such as start up logs from the gunicorn arbiter
[formatter_json]
format={"timestamp":"%(asctime)s", "severity":"%(levelname)s", "level":"%(levelname)s", "service":"rh_ui", "event":"%(message)s"}
datefmt=%Y-%m-%dT%H:%M:%S
class=logging.Formatter
[logger_gunicorn.error]
level=INFO
handlers=gunicorn_error
propagate=0
qualname=gunicorn.error
[handler_gunicorn_error]
class=StreamHandler
formatter=json
args=(sys.stderr, )
# Gunicorn intercepts and formats the application logs with the root logger,
# but our application is already configured to log structured JSON, so we configure the root logger to pass through
# logs without altering the formatting
[formatter_passthrough]
format=%(message)s
class=logging.Formatter
[logger_root]
level=INFO
handlers=passthrough
[handler_passthrough]
class=StreamHandler
formatter=passthrough
args=(sys.stdout, )