Custom logging handler not picked up

17 views
Skip to first unread message

Andreas Jung

unread,
Jan 24, 2013, 7:16:19 AM1/24/13
to pylons-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I added a custom logging handler to my dev.ini file:

[loggers]
keys = root, myapp

[logger_myapp]
handlers = dogapi_handler

[handler_dogapi]
class = mib.pyramid.logging.DogAPILoggingHandler

This also leads to an

ImportError: No module named pyramid

during the Pyramid startup phase

The handler itself is defined as

class DogAPILoggingHandler(logging.Handler):
def emit(...)

logging.handlers['dogapi'] = DogAPILoggingHandler

Basic question is if this is the right way to configure a custom
logging handler and why the import error occurs. The module
should be importable, or?

- -aj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJRASYTAAoJEADcfz7u4AZj0ccLv0aVyapimOUh3qcTHVU+7w5g
SW+br5PzxE/kFoBB9R+EBU3JlWI2DiV3yDTCZWfsS9+cndpuQg6/vU3jZGwrJgUA
sEd5WWL8+Be5fjv+ExiUP29lU+PDDZh1yy8RXSfVtNUZGw9eGljNBSuuyKjHhhDL
5A0b4OF3YX3u/WvfeC6dquwf5kviF/3QCbMrjAOQg/nrtvtqyGxnVEYfEH4axGgQ
OCwYoNSX8p58L0Atjpwt6eX+/SrNlq9ob2+Kz/7CrppsMmiq5y+sJmq5xicD4YFq
1RTSofOZSFbPBL8EFL37lpLPnaz2ufbuPUwZQioMZ9WVos4sOQIsJ/+UTIuFNq+K
Lb2Nv2A+uLrFhhJhCW1p1No+mW2uaZDxeMfjZJ0c7Bv9P8NiLjQQ8q+sJcpO9/OS
c3rgVKqZJeB5FSqYaSkv/aSaI5/qmW0fQqOtTSVAZc9PMmyBV7JVufYxbxrIimk4
7iP6u0a1nIQbp4rPA4Yvd3GmnV5WDJM=
=2Pya
-----END PGP SIGNATURE-----
lists.vcf

Michael Merickel

unread,
Jan 24, 2013, 8:14:10 AM1/24/13
to Pylons
1) Do not name your sub-package "pyramid" unless you are using "from __future__ import absolute_import". Even then it's just prone to causing import errors.

2) [handler_dogapi] implies that the handlers argument = dogapi, not dogapi_handler.

3) You need a [handlers] section defining the possible handlers, such as keys = dogapi.


HTH,
Michael



--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Andreas Jung

unread,
Jan 24, 2013, 8:16:20 AM1/24/13
to pylons-...@googlegroups.com
Forget it, I was just coding on the wrong machine and testing
against a different one :-) ...classical fail :-)

Andreas
> <mailto:pylons-...@googlegroups.com>.
> To unsubscribe from this group, send email to
> pylons-discus...@googlegroups.com
> <mailto:pylons-discuss%2Bunsu...@googlegroups.com>.
lists.vcf
Reply all
Reply to author
Forward
0 new messages