Commit f17d170b authored by Christian Jürges's avatar Christian Jürges
Browse files

send warning and up log msg to error log

parent 957017ba
......@@ -68,10 +68,11 @@ class Worker(threading.Thread):
p.kill()
p.communicate()
logging.error(
'%s: occ cron call [%s %s] timed out after 60 seconds. Return code: %d' % (
'%s: occ cron call [%s %s] timed out after %d seconds. Return code: %d' % (
self.counter,
self.php,
self.occ_path,
self.max_execution_time,
p.returncode))
logging.info(
......@@ -129,7 +130,7 @@ def main():
exit(-1)
# try to acquire lock to redis
rl = redis_lock.Lock(r, my_path + '/occron.lock', expire=10, auto_renewal=True)
rl = redis_lock.Lock(r, '/occron.lock', expire=10, auto_renewal=True)
if rl.acquire(blocking=False):
# read list of oc instances...
......@@ -189,27 +190,25 @@ if __name__ == '__main__':
log_file_name = my_path + '/' + name + '.occron.log'
log_error_file_name = my_path + '/' + name + '.occron.error.log'
trh = logging.handlers.TimedRotatingFileHandler(
tr_handler = logging.handlers.TimedRotatingFileHandler(
filename=log_file_name,
when='midnight',
backupCount=7
)
treh = logging.handlers.TimedRotatingFileHandler(
tr_handler.setLevel(logging.INFO)
tre_handler = logging.handlers.TimedRotatingFileHandler(
filename=log_error_file_name,
when='midnight',
backupCount=7
)
logging.basicConfig(
handlers=[trh],
level=logging.INFO,
format='%(asctime)s:%(levelname)s:%(message)s',
)
tre_handler.setLevel(logging.WARNING)
logging.basicConfig(
handlers=[treh],
level=logging.ERROR,
handlers=[tr_handler, tre_handler],
level=logging.INFO,
format='%(asctime)s:%(levelname)s:%(message)s',
)
......
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