(Sorry for the long-winded description. My actual workaround is at the bottom of this post.)
First let me say that I haven't done any serious programming in over a decade, so my ability to understand Sickbeard's code is VERY rusty. My apologies if I draw any inaccurate conclusions.
I'm not sure if it's always behaved this way or not, but Sickbeard clutters up my syslog (in my case on Fedora 17, /var/log/messages) with all logging messages from INFO upward (no DEBUG messages appear to be logged). This duplicates the output being sent to Sickbeard's file-based rotating logfiles, and is obviously both redundant and messy.
Being unfamiliar with Sickbeard's code, and finding absolutely nothing pertinent on Google regarding Sickbeard and syslog output, it took me forever to track this down.
Sickbeard's logging initializer seems sets things up to log all INFO-and-up messages to sys.stderr console output. On (at least) Fedora 17, the default behaviour of systemd-journal is to echo any service's console output to syslog, resulting in all Sickbeard's logging output getting duplicated into general syslog. The specific chunk of code that (I think) is doing this is:
In: sickbeard/logger.py
- Code: Select all
def initLogging(self, consoleLogging=True):
self.log_file = os.path.join(sickbeard.LOG_DIR, self.log_file)
self.cur_handler = self._config_handler()
logging.getLogger('sickbeard').addHandler(self.cur_handler)
# define a Handler which writes INFO messages or higher to the sys.stderr
if consoleLogging:
console = logging.StreamHandler()
console.setLevel(logging.INFO)
# set a format which is simpler for console use
console.setFormatter(logging.Formatter('%(asctime)s %(levelname)s::%(message)s', '%H:%M:%S'))
# add the handler to the root logger
logging.getLogger('sickbeard').addHandler(console)
My meagre coding skills failed to find any way to disable console-logging output within Sickbeard via configuration. This method's definition provides a default value for the consoleLogging argument of True, and the method's only invocation seems to not override the default. I'm unsure why console-logging would be a required behaviour, but I'm assuming it's desired in some scenarios.
Workaround
My workaround is to update my Sickbeard's systemd service unit file to redirect stderr console output to /dev/null, suppressing it before it can get echoed to syslog. This only affects Sickbeard; other services are unaffected.
In the [Service] section of your Sickbeard service unit file, add the following line: StandardError=null . For example, my full service unit file looks like this:
- Code: Select all
[Unit]
Description=Internet PVR for your TV Shows
[Service]
ExecStart=/usr/bin/python /home/sabnzbd/sickbeard/SickBeard.py
Type=simple
User=sabnzbd
Group=sabnzbd
StandardError=null
[Install]
WantedBy=multi-user.target
Cheers;
WireRydr

