I'm trying to create logs using following logging config. But in handler 'info_file_handler', mode: 'w' does not overwrite the file with class:logging.handlers.RotatingFileHandler. should I replace the class with logging.FileHandler, output log file gets overwrite. does logging.handlers.RotatingFileHandler need some extra code to be added here?
# https://gist.github.com/kingspp/9451566a5555fb022215ca2b7b802f19
version: 1
disable_existing_loggers: true
formatters:
standard:
# format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
format: "%(levelname)s: %(message)s"
error:
format: "%(levelname)s <PID %(process)d:%(processName)s> %(name)s.%(funcName)s(): %(message)s"
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: standard
stream: ext://sys.stdout
info_file_handler:
class: logging.handlers.RotatingFileHandler
level: INFO
formatter: standard
filename: info.log
mode: 'w'
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8
root:
level: NOTSET
handlers: [console]
propogate: no
loggers:
my_module:
level: INFO
handlers: [info_file_handler]
propogate: no