From 18098e4d1edf7b79a0ffc210093830e9d8494eac Mon Sep 17 00:00:00 2001 From: German Service Network Date: Sun, 19 Jul 2020 10:23:38 +0200 Subject: [PATCH] Add logrotate by date --- raspbmirror.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/raspbmirror.py b/raspbmirror.py index 29cff78..7ce4e0c 100644 --- a/raspbmirror.py +++ b/raspbmirror.py @@ -46,8 +46,9 @@ args = parser.parse_args() lockfd = os.open('.',os.O_RDONLY) fcntl.flock(lockfd,fcntl.LOCK_EX | fcntl.LOCK_NB) +dtNow = datetime.now() logpath = os.path.dirname(os.path.realpath(__file__)) -logging.basicConfig(filename=logpath+'/raspbmirror.log',format='%(asctime)s %(levelname)s: %(message)s', level=logging.DEBUG) +logging.basicConfig(filename=logpath+'/'+dtNow.strftime("%Y-%m-%d")+'_raspbmirror.log',format='%(asctime)s %(levelname)s: %(message)s', level=logging.DEBUG) def addfilefromdebarchive(filestoverify,filequeue,filename,sha256,size): size = int(size) -- 2.43.0