[FIX] netsvc: logs to syslog

When starting the Odoo server with the parameters --syslog,
the logs are supposed to be pushed in the syslog.

This was no longer the case since e9d047e611.
Indeed, if no address is specified ('localhost', 514) is used,
which not always work. We therefore have no choice to define an address
which is '/var/run/log' for MacOSx,
and '/dev/log' for any other linux system.

opw-633074
This commit is contained in:
Denis Ledoux 2015-04-21 18:07:01 +02:00
parent 8a6e859c2b
commit 64fd1dc636
1 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,7 @@
import logging
import logging.handlers
import os
import platform
import pprint
import release
import sys
@ -142,8 +143,10 @@ def init_logger():
# SysLog Handler
if os.name == 'nt':
handler = logging.handlers.NTEventLogHandler("%s %s" % (release.description, release.version))
elif platform.system() == 'Darwin':
handler = logging.handlers.SysLogHandler('/var/run/log')
else:
handler = logging.handlers.SysLogHandler()
handler = logging.handlers.SysLogHandler('/dev/log')
format = '%s %s' % (release.description, release.version) \
+ ':%(dbname)s:%(levelname)s:%(name)s:%(message)s'