[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:
+4
-1
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user