generated from annotation-ai/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 23
/
logging.conf
35 lines (28 loc) · 833 Bytes
/
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
35
[loggers]
keys=root
[handlers]
keys=consoleHandler,fileHandler
[formatters]
keys=consoleFormatter,fileFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler,fileHandler
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=INFO
formatter=consoleFormatter
args=(sys.stdout,)
[handler_fileHandler]
class=logging.handlers.RotatingFileHandler
level=DEBUG
maxBytes=10485760 # 10MB
backupCount=100
args=("sample.log",)
formatter=fileFormatter
# another option for dynamically setting filename
# args=(__import__("datetime").datetime.now().strftime("%%Y%%m%%d-%%H%%M%%S.log"),)
[formatter_consoleFormatter]
format=%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s
[formatter_fileFormatter]
format=%(asctime)s - %(levelname)s - %(processName)s - %(threadName)s - %(filename)s:%(lineno)d - %(message)s