From: German Service Network Date: Sun, 19 Jul 2020 08:23:38 +0000 (+0200) Subject: Add logrotate by date X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18098e4d1edf7b79a0ffc210093830e9d8494eac;p=raspbmirror.git Add logrotate by date --- 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)