On Jun 24, 4:07 am, Peng Yu <pengyu...@gmail.com> wrote: > %(module)s only print to "__init__". However, I need the fullname > a.b.__init__. I looked at the manual, but I don't see what format > string I should supply. Would you please let me know? >
Did you look at this part of the documentation? http://docs.python.org/library/logging.html#formatter-objects You should use in each of your modules logger = logging.getLogger(__name__) and in the format string, use %(name)s. This will give "a.b" for a logger defined in <pythonpath>/a/b/__init__.py, "a" for a logger defined in <pythonpath>/a/__init__.py, "a.b.c" for a logger defined in <pythonpath>/a/b/c.py, and so on. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list