diff options
| author | Vo Minh Thu <vmt@openerp.com> | 2013-02-06 11:34:59 +0100 |
|---|---|---|
| committer | Vo Minh Thu <vmt@openerp.com> | 2013-02-06 11:34:59 +0100 |
| commit | 941f6ebc104f5bd49cd3670169dc795812d604ae (patch) | |
| tree | 66d313d261828bee87a7cfb636f9d8495f1cacba | |
| parent | 3a2286bd78ab13ef9b60c3cb9652c3bd900ddf7e (diff) | |
[FIX] logging: sys.stdout has not a fileno() method when running behind mod_wsgi.
bzr revid: vmt@openerp.com-20130206103459-2mmgagrh59c23804
| -rw-r--r-- | openerp/netsvc.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/openerp/netsvc.py b/openerp/netsvc.py index 533b1659191..d6f9dc49d84 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -186,7 +186,13 @@ def init_logger(): # Normal Handler on standard output handler = logging.StreamHandler(sys.stdout) - if isinstance(handler, logging.StreamHandler) and os.isatty(handler.stream.fileno()): + # Check that handler.stream has a fileno() method: when running OpenERP + # behind Apache with mod_wsgi, handler.stream will have type mod_wsgi.Log, + # which has no fileno() method. (mod_wsgi.Log is what is being bound to + # sys.stderr when the logging.StreamHandler is being constructed above.) + if isinstance(handler, logging.StreamHandler) \ + and hasattr(handler.stream, 'fileno') \ + and os.isatty(handler.stream.fileno()): formatter = ColoredFormatter(format) else: formatter = DBFormatter(format) |
