Search code examples
pythonloggingpyramid

Add custom log handler to pyramid


What is a correct way to add custom log handler to pyramid? In the ini file I'm trying to define one:

[handler_redis]
class = RedisLogHandler
args =
level = NOTSET
formatter = generic

But I'm getting (not much surprising) error "ImportError: No module named RedisLogHandler" I tried importing it in main init.py file, but with no luck.


Solution

  • You should provide a package path:

    [handler_redis]
    class = mypackage.myhandlers.RedisLogHandler
    args =
    level = NOTSET
    formatter = generic