generated from geoadmin/template-service-flask
-
Notifications
You must be signed in to change notification settings - Fork 2
/
logging-cfg-local.yml
112 lines (107 loc) · 2.73 KB
/
logging-cfg-local.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
version: 1
disable_existing_loggers: False # this allow to get logger at module level
root:
handlers:
- console
- file-standard
- file-json
level: DEBUG
propagate: True
# Remove all handlers for werkzeug log entries - prevents duplicated logging
loggers:
werkzeug:
handlers: []
gunicorn.error:
level: DEBUG
handlers:
- console
- file-standard
- file-json
gunicorn.access:
level: DEBUG
handlers:
- console
- file-standard
- file-json
filters:
isotime:
(): logging_utilities.filters.TimeAttribute
isotime: False
utc_isotime: True
flask:
(): logging_utilities.filters.flask_attribute.FlaskRequestAttribute
attributes:
- path
- method
- headers
- remote_addr
- json
- query_string
formatters:
standard:
format: "[%(asctime)s] %(levelname)-8s - %(name)-26s : %(message)s"
verbose:
(): logging_utilities.formatters.extra_formatter.ExtraFormatter
format: "[%(asctime)s] %(levelname)-8s - %(name)-26s : %(message)s"
extra_fmt: " : path=%(flask_request_path)s headers=%(flask_request_headers)s payload=%(flask_request_json)s"
json:
(): logging_utilities.formatters.json_formatter.JsonFormatter
add_always_extra: False
filter_attributes:
- utc_isotime
- flask_request_path
- flask_request_method
- flask_request_query_string
- flask_request_headers
- flask_request_json
- flask_request_remote_addr
remove_empty: True
ignore_missing: True
fmt:
time: utc_isotime
level: levelname
logger: name
module: module
function: funcName
pidTid: "%(process)x/%(thread)x"
excInfo: exc_info
request:
id: flask_request_headers.X-Amz-Cf-Id
path: "%(flask_request_path)s"
method: "%(flask_request_method)s"
queryString: "%(flask_request_query_string)s"
headers: flask_request_headers.
remoteAddr: "%(flask_request_remote_addr)s"
payload: "%(flask_request_json).128s"
response:
statusCode: response.status_code
headers: response.headers.
duration: "%(duration)s"
payload: "%(response.json).128s"
message: message
handlers:
console:
class: logging.StreamHandler
formatter: standard
stream: ext://sys.stdout
filters:
- isotime
- flask
file-standard:
level: DEBUG
class: logging.FileHandler
formatter: verbose
filename: ${LOGS_DIR}/server-standard-logs.txt
mode: w
filters:
- isotime
- flask
file-json:
level: DEBUG
class: logging.FileHandler
formatter: json
filename: ${LOGS_DIR}/server-json-logs.json
mode: w
filters:
- isotime
- flask