Skip to content

Commit

Permalink
Fixed filename for MyTimedRotatingFileHandler to be compliant with
Browse files Browse the repository at this point in the history
previous uses
  • Loading branch information
d-ylee committed Apr 9, 2024
1 parent dd78352 commit 5062326
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/python/WMCore/WMLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def sqldebug(msg):
"""
logging.log(logging.SQLDEBUG, msg)


def setupRotatingHandler(fileName, maxBytes = 200000000, backupCount = 3):
"""
_setupRotatingHandler_
Expand Down Expand Up @@ -62,7 +63,12 @@ class MyTimedRotatingFileHandler(TimedRotatingFileHandler):
https://stackoverflow.com/questions/338450/timedrotatingfilehandler-changing-file-name
"""
def __init__(self, logName, interval, backupCount):
super(MyTimedRotatingFileHandler, self).__init__(logName, when=interval,
# Add todayStr to log name, like with rotatelogs
todayStr = date.today().strftime("%Y%m%d")
baseName = logName.split('-')
baseName.insert(1, todayStr)
filename = '-'.join(baseName)
super(MyTimedRotatingFileHandler, self).__init__(filename, when=interval,
backupCount=backupCount)

def doRollover(self):
Expand Down

0 comments on commit 5062326

Please sign in to comment.