Skip to content

Log full traceback with log.exception in exception handlers #382

@SebastiaanZ

Description

@SebastiaanZ

While trying to reload the reddit cog, I noticed that the cogs cog doesn't log the full traceback in the except blocks, but just the exception message using log.error. It would be better to use log.exception here to make sure that the full traceback is included instead of just a message like 'NoneType' object has no attribute 'startswith'. (log.exception automatically includes the full traceback when used in an exception handler, no additional arguments required.)

I suspect that more cogs do this, so I think it's a good idea to check all the cogs after the Django migration is completed to change the log methods to log.exception inside exception handlers where appropriate.

Example from the cogs cog (it's both in master and django):

log.error(f"{ctx.author} requested we load the '{cog}' cog, "

log.error(f"{ctx.author} requested we load the '{cog}' cog, "

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions