diff --git a/cleanupagents/Logging.py b/cleanupagents/Logging.py index f946dc7..b52057c 100644 --- a/cleanupagents/Logging.py +++ b/cleanupagents/Logging.py @@ -13,10 +13,10 @@ import cleanupagents.Utils from cleanupagents.Utils import Singleton from cleanupagents.Utils import to_bool -CONSOLE_FORMAT = "%(asctime)s {}[%(levelname)s]{} %(message)s" +CONSOLE_FORMAT = "{}[%(levelname)s]{} %(message)s" FILE_FORMAT = "%(asctime)s %(levelname)s %(message)s" JSON_FORMAT = "(asctime) (levelname) (message)" - +TIME_FORMAT = "%Y-%m-%d %H:%M:%S" def _should_do_markup(): py_colors = os.environ.get("PY_COLORS", None) @@ -85,7 +85,7 @@ class Log: def _get_file_handler(self, logfile, json=False): handler = logging.handlers.RotatingFileHandler(logfile, maxBytes=512000, backupCount=5) handler.setLevel(logging.DEBUG) - handler.setFormatter(logging.Formatter(FILE_FORMAT)) + handler.setFormatter(logging.Formatter(FILE_FORMAT, TIME_FORMAT)) if json: handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT))