forked from bobbui/json-logging-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
25 lines (18 loc) · 610 Bytes
/
test.py
File metadata and controls
25 lines (18 loc) · 610 Bytes
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
# Create the application instance
import logging
import sys
from logging.handlers import TimedRotatingFileHandler
import connexion
import json_logging
app = connexion.App(__name__, specification_dir='./')
json_logging.ENABLE_JSON_LOGGING = True
json_logging.init_connexion()
json_logging.init_request_instrument(app)
json_logging._logger
logger = logging.getLogger("test-logger")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
handler = TimedRotatingFileHandler('info.log', 'midnight', 1, utc=True)
logger.addHandler(handler)
if __name__ == '__main__':
app.run()