Title: Error when debugging logging.FileHandler subclass __init__ method
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fcodvpt
Priority: normal Keywords:

Created on 2020-10-22 16:37 by fcodvpt, last changed 2020-10-22 16:37 by fcodvpt.

File name Uploaded Description Edit fcodvpt, 2020-10-22 16:37 Code with the FileHandler subclass
Messages (1)
msg379313 - (view) Author: Fran├žoise CONIL (fcodvpt) Date: 2020-10-22 16:37
In pdb, when I hit "a" to see __init__ parameters of a logging.FileHandler subclass, I get an error because __repr__ needs a logging level. The level has been removed from the parameters by configure_handler() when it instanciates the handler. The level is set after the handler instanciation.

I do not know if it can be changed or if I missed something.

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib/python3.8/logging/", line 744, in configure_handler
    result = factory(**kwargs)
  File "/home/fconil/Progs/python/logging/", line 53, in __init__
    pfilename = f"{filename}-{os.getpid()}.log"
  File "/home/fconil/Progs/python/logging/", line 53, in __init__
    pfilename = f"{filename}-{os.getpid()}.log"
  File "/usr/lib/python3.8/", line 88, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.8/", line 112, in dispatch_line
  File "/usr/lib/python3.8/", line 262, in user_line
    self.interaction(frame, None)
  File "/usr/lib/python3.8/", line 357, in interaction
  File "/usr/lib/python3.8/", line 322, in _cmdloop
  File "/usr/lib/python3.8/", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python3.8/", line 423, in onecmd
    return cmd.Cmd.onecmd(self, line)
  File "/usr/lib/python3.8/", line 217, in onecmd
    return func(arg)
  File "/usr/lib/python3.8/", line 1146, in do_args
    self.message('%s = %r' % (name, dict[name]))
  File "/usr/lib/python3.8/logging/", line 1186, in __repr__
    level = getLevelName(self.level)
AttributeError: 'MultiFileHandler' object has no attribute 'level'
Date User Action Args
2020-10-22 16:37:47fcodvptcreate