I am going to answer myself because if somebody runs in the same problem it is easier to find.
The problem seems to be with the FluentHandler
. Using Brandon's Logging tree as mentioned by @Thomas we could see that the loggers were correctly added.
However further debugging showed that if you not explicitly set the loglevel it is set to NotSet
. Somehow in "ordinary" python this is ok and the record is emitted. In Django however NotSet
level logs are thrown away. I don't know if this is standard Django behaviour, but it caused a lot of headaces. Below is the code that worked:
def get_fluentd_logger(name):
import logging
from fluent import handler
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(name)
logger.level = logging.INFO
handler = handler.FluentHandler(name, host='localhost', port=24224)
handler.level = logging.INFO
logger.addHandler(handler)
return logger