Commit aca96e01 authored by Oleg Nikulin's avatar Oleg Nikulin

Ротация логов

parent e711f2bb
...@@ -8,6 +8,8 @@ import threading ...@@ -8,6 +8,8 @@ import threading
from threading import Event from threading import Event
import json import json
import logging import logging
import logging.handlers
import sys import sys
import traceback import traceback
import os import os
...@@ -34,7 +36,7 @@ logger = logging.getLogger(__name__) ...@@ -34,7 +36,7 @@ logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
logFormatter_file = logging.Formatter('%(asctime)s %(levelname)s: %(message)s', '%d.%m.%Y %H:%M:%S') logFormatter_file = logging.Formatter('%(asctime)s %(levelname)s: %(message)s', '%d.%m.%Y %H:%M:%S')
logHandler_file = logging.FileHandler( os.path.join(os.path.dirname(__file__), 'hddtempserial.log')) logHandler_file = logging.handlers.RotatingFileHandler( os.path.join(os.path.dirname(__file__), 'hddtempserial.log'), maxBytes=64*1024*1024, backupCount=5 )
logHandler_file.setLevel(logging.DEBUG) logHandler_file.setLevel(logging.DEBUG)
logHandler_file.setFormatter(logFormatter_file) logHandler_file.setFormatter(logFormatter_file)
logger.addHandler(logHandler_file) logger.addHandler(logHandler_file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment