Rootlogger

This commit is contained in:
Ruben van de Ven 2019-11-12 18:09:48 +01:00
parent 4d2a52ddb1
commit a4858b4b8c

View file

@ -38,6 +38,7 @@ if __name__ == '__main__':
fmt="%(asctime)s %(hostname)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s" fmt="%(asctime)s %(hostname)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
) )
rootLogger = logging.getLogger()
logger = logging.getLogger("hugvey") logger = logging.getLogger("hugvey")
logFileHandler = logging.handlers.RotatingFileHandler( logFileHandler = logging.handlers.RotatingFileHandler(
@ -49,12 +50,12 @@ if __name__ == '__main__':
fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s" fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
)) ))
logFileHandler.setLevel(logging.DEBUG) logFileHandler.setLevel(logging.DEBUG)
logger.addHandler(logFileHandler) rootLogger.addHandler(logFileHandler)
# logger.setLevel(1) # to send all records to cutelog # logger.setLevel(1) # to send all records to cutelog
socket_handler = logging.handlers.SocketHandler('127.0.0.1', 19996) # default listening address socket_handler = logging.handlers.SocketHandler('127.0.0.1', 19996) # default listening address
socket_handler.setLevel(logging.DEBUG) socket_handler.setLevel(logging.DEBUG)
logger.addHandler(socket_handler) rootLogger.addHandler(socket_handler)
logger.info("Start server") logger.info("Start server")
command = CentralCommand(args=args, debug_mode=args.verbose > 0) command = CentralCommand(args=args, debug_mode=args.verbose > 0)