-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging.conf
34 lines (29 loc) · 1.05 KB
/
logging.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
# Define the available loggers in the configuration.
# 'MyNewApp' is the base logger that other loggers can inherit from.
[loggers]
keys=root
# Define the available handlers.
# 'file_handler' will handle the log output to a file.
[handlers]
keys=file_handler
# Define the available formatters.
# 'formatter' specifies the format of the log messages.
[formatters]
keys=formatter
# Root logger configuration.
# Set the log level to DEBUG and associate the file handler.
[logger_root]
level=DEBUG
handlers=file_handler
# Define the 'file_handler' using TimedRotatingFileHandler.
# Rotates logs every day and stores them in 'logs/my_app.log'.
# Retains 30 days of log files (you can adjust this in 'backupCount' parameter).
[handler_file_handler]
class=logging.handlers.TimedRotatingFileHandler
level=DEBUG
formatter=formatter
args=('logs/my_app.log', 'midnight', 1, 30)
# Define the format for log messages.
# Example output: '2024-08-29 12:34:56,789 root DEBUG This is a log message.'
[formatter_formatter]
format=%(asctime)s %(name)-12s %(levelname)-8s %(message)s