X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=update-xmpp-status.py;h=116db8240f7db4d8dde73ac0b2638c62b7c90c49;hb=d263eec6d21cd566c06b2f1038cdce967c7cf8a8;hp=2c40cf2a2362e20893bdc4f5ddd0c28cb56f9e19;hpb=ed5e7e306b88e1662073e0db1da6e521b8ab711c;p=svn42.git diff --git a/update-xmpp-status.py b/update-xmpp-status.py index 2c40cf2..116db82 100644 --- a/update-xmpp-status.py +++ b/update-xmpp-status.py @@ -5,6 +5,7 @@ import os.path import sys #import threading import logging +import logging.handlers import urllib import time import signal @@ -14,14 +15,14 @@ import subprocess import types import ConfigParser -logging.basicConfig( - level=logging.INFO, - #level=f, - #level=logging.DEBUG, - filename='/var/log/tmp/update-xmpp-status.log', - format="%(asctime)s %(message)s", - datefmt="%Y-%m-%d %H:%M:%S" - ) +logger = logging.getLogger() +logger.setLevel(logging.INFO) +#logger.setLevel(logging.DEBUG) +lh_syslog = logging.handlers.SysLogHandler(address="/dev/log",facility=logging.handlers.SysLogHandler.LOG_LOCAL2) +lh_syslog.setFormatter(logging.Formatter('update-xmpp-status.py: %(levelname)s %(message)s')) +logger.addHandler(lh_syslog) +lh_stderr = logging.StreamHandler() +logger.addHandler(lh_stderr) class UWSConfig: def __init__(self,configfile=None): @@ -150,7 +151,7 @@ def sendXmppMsg(recipients, msg, resource = "torwaechter", addtimestamp = True, if resource: sendxmpp_cmd += "-r %s " % resource if noofflinemsg: - sendxmpp_cmd += "--headline " + sendxmpp_cmd += "--message-type=headline " sendxmpp_cmd += recipients if addtimestamp: @@ -181,7 +182,7 @@ def touchURL(url): f.read() f.close() except Exception, e: - logging.error("tochURL: "+str(e)) + logging.error("touchURL: "+str(e)) def displayOpen(): distributeXmppMsg(uwscfg.xmpp_msg_opened % action_by)