Skip to content

Custom formatters ignored in RichHandler when rich_tracebacks=True  #1079

@willmcgugan

Description

@willmcgugan

Hi,

I am not sure if it is a bug or intended behavior. But I configured a RichHandler with rich traceback toggled on. I also added a custom formatter to include the process name and Id in all log messages.

This works fine for all logging levels with the exception of logging exceptions/errors. Raised errors are logged nicely with rich tracebacks but the process name isn’t included in the logged error message before the traceback. It seems the configured formatter is simply ignored in this case.

This works however, if I replace the RichHandler with a normal StreamHandler. Of course I can manually add the process name to the rich handled error traceback. But if a user of our library doesn’t use rich, he would see the process name twice (once because of the formatter and once because of the manual addition).

Any feedback on this issue is much appreciated :)

Best regards
Lars

Originally posted by @LarsHill in #1072

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions