[FIX] core: remove custom open in logging facility
Remove custom open introduced by bpo-26789 as we do not need it. closes odoo/odoo#112453 X-original-commit: 8eaac9744b93e7132827edb2a59c28bb43732ec1 Related: odoo/enterprise#36978 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com> Co-authored-by: Martin Trigaux <mat@odoo.com>
This commit is contained in:
co-authored by
Martin Trigaux
parent
926d8c6c5d
commit
2fdacf2334
+11
-1
@@ -25,6 +25,16 @@ def log(logger, level, prefix, msg, depth=None):
|
||||
logger.log(level, indent+line)
|
||||
indent=indent_after
|
||||
|
||||
|
||||
class WatchedFileHandler(logging.handlers.WatchedFileHandler):
|
||||
def __init__(self, filename):
|
||||
super().__init__(filename)
|
||||
# Unfix bpo-26789, in case the fix is present
|
||||
self._builtin_open = None
|
||||
|
||||
def _open(self):
|
||||
return open(self.baseFilename, self.mode, encoding=self.encoding, errors=self.errors)
|
||||
|
||||
class PostgreSQLHandler(logging.Handler):
|
||||
""" PostgreSQL Logging Handler will store logs in the database, by default
|
||||
the current database, can be set using --log-db=DBNAME
|
||||
@@ -175,7 +185,7 @@ def init_logger():
|
||||
if dirname and not os.path.isdir(dirname):
|
||||
os.makedirs(dirname)
|
||||
if os.name == 'posix':
|
||||
handler = logging.handlers.WatchedFileHandler(logf)
|
||||
handler = WatchedFileHandler(logf)
|
||||
else:
|
||||
handler = logging.FileHandler(logf)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user