tuned: fixed logging output in deamon mode, log filename change
This commit is contained in:
parent
e57b96ddc3
commit
583be1877d
2 changed files with 6 additions and 4 deletions
1
tuned
1
tuned
|
|
@ -77,6 +77,7 @@ if __name__ == "__main__":
|
|||
for (opt, val) in opts:
|
||||
if opt in ['-d', "--daemon"]:
|
||||
daemon = True
|
||||
log.switchToFile()
|
||||
elif opt in ['-c', "--config"]:
|
||||
cfgfile = val
|
||||
elif opt in ['-D', "--debug"]:
|
||||
|
|
|
|||
|
|
@ -36,17 +36,18 @@ def disableString(name):
|
|||
level = logging._levelNames.get(str(name).upper(), logging.CRITICAL)
|
||||
logging.disable(level)
|
||||
|
||||
######
|
||||
|
||||
logging.setLoggerClass(TunedLogger)
|
||||
|
||||
console_handler = logging.StreamHandler()
|
||||
file_handler = logging.handlers.RotatingFileHandler("/tmp/tuned.log", maxBytes=200*1000, backupCount=2)
|
||||
# intialization
|
||||
|
||||
tuned_logger = logging.getLogger("tuned")
|
||||
tuned_logger.setLevel(logging.INFO)
|
||||
|
||||
formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s: %(message)s")
|
||||
|
||||
console_handler = logging.StreamHandler()
|
||||
file_handler = logging.handlers.RotatingFileHandler("/var/log/tuned.log", maxBytes=200*1000, backupCount=2)
|
||||
|
||||
console_handler.setFormatter(formatter)
|
||||
file_handler.setFormatter(formatter)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue