Bugs item #1508253, was opened at 2006-06-18 19:33
Message generated for change (Comment added) made by vsajip
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1508253&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: tdir (tdir)
Assigned to: Vinay Sajip (vsajip)
Summary: logging fileConfig swallows handler exception 

Initial Comment:
If you specify a handler such as a RotatingFileHandler
and the path you provide in the args specification
('option') is bad, config.fileConfig() catches the
exception and 'swallows' it. The result is later on,
when that handler is specified for a logger, you get an
exception saying there is no such handler. A much
friendlier behavior would be for fileConfig() to raise
an exception so the real cause of the problem can be
easily identified. Also, if there is a bug in the code
itself, it would also get swallowed in similar fashion.
In general, silently swallowing exceptions is rarely
the best choice IMHO.

Example ini with bad path (assuming /bad/path does not
exist):
[handler_defaultrotatingfile]
class=handlers.RotatingFileHandler
args=("/bad/path/logdir/my_log.log", 'w', 100000, 10)
formatter=std



----------------------------------------------------------------------

>Comment By: Vinay Sajip (vsajip)
Date: 2006-06-23 06:10

Message:
Logged In: YES 
user_id=308438

Ok, then the bug has already been fixed (or superseded by 
changes to the code).

I'll close this report: if you want to use the latest code, 
just download it from the Python subversion repository. It 
should run without problems in 2.4.2.

----------------------------------------------------------------------

Comment By: tdir (tdir)
Date: 2006-06-22 23:18

Message:
Logged In: YES 
user_id=1541624

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit
(Intel)] on win32

ABOVE IS THE PYTHON SIGNON

I HAVE ALSO ATTACHED THE config.py FROM THE INSTALL. IT
CONTAINS NO _install_handlers 

APPEARS TO BE A VERY DIFFERENT VERSION FROM YOURS




----------------------------------------------------------------------

Comment By: Vinay Sajip (vsajip)
Date: 2006-06-22 16:37

Message:
Logged In: YES 
user_id=308438

Can you give some more details? I don't get the problem: see
the transcript below.

ActivePython 2.4 Build 243 (ActiveState Corp.) based on
Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import logging.config
>>> logging.config.fileConfig("junk.ini")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python\lib\logging\config.py", line 83, in fileConfig
    handlers = _install_handlers(cp, formatters)
  File "C:\Python\lib\logging\config.py", line 151, in
_install_handlers
    h = apply(klass, args)
  File "C:\Python\lib\logging\handlers.py", line 109, in
__init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding)
  File "C:\Python\lib\logging\handlers.py", line 61, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding)
  File "C:\Python\lib\logging\__init__.py", line 770, in
__init__
    stream = open(filename, mode)
IOError: [Errno 2] No such file or directory:
'/bad/path/junk.log'


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1508253&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to