bot icon indicating copy to clipboard operation
bot copied to clipboard

!ext-like command to change logging level

Open Akarys42 opened this issue 4 years ago • 4 comments

We currently have the !ext command to list, unload and load cogs.

image

It would be useful to have a similar command to lower the log level to DEBUG or TRACE during runtime.

Do note that some cog relies on other files like HelpChannel is actually made of four files. We need to find a way to detect those additional files and also change their logging level.

Akarys42 avatar Apr 07 '21 07:04 Akarys42

Do note that some cog relies on other files like HelpChannel is actually made of four files. We need to find a way to detect those additional files and also change their logging level.

Setting the level on the parent logger of the package will make all the children inherit it so we don't need to discover those manually.

But I'm not sure how util logs should be handled with changing levels, for example the utils.lock will continue logging with the previous level even for information that is relevant to the ext where the level was changed, but then changing it will also cause logs from locks from all the other exts to change. The schedulers also use the scheduler's name for the logger which should be taken care of

Numerlor avatar Apr 07 '21 08:04 Numerlor

Setting the level on the parent logger of the package will make all the children inherit it so we don't need to discover those manually.

Cool, that should work then.

But I'm not sure how util logs should be handled with changing levels, for example the utils.lock will continue logging with the previous level even for information that is relevant to the ext where the level was changed, but then changing it will also cause logs from locks from all the other exts to change.

I think we should also be able to lower the logging level of utils just like with other cogs. It isn't an issue if we start logging calls from any cog.

Akarys42 avatar Apr 07 '21 08:04 Akarys42

I've never felt the need to change the log level during runtime at all, let alone for specific modules. This gives me the impression that it's a rare occurrence. In any case, is it not simple enough to do an internal eval to change the log level?

MarkKoz avatar Apr 07 '21 19:04 MarkKoz

@Akarys42 would an acceptable implementation of this be per-cog?

Kronifer avatar May 17 '21 18:05 Kronifer

Closed in 2025 review of open issues. We do not feel there is a large need for this feature.

jb3 avatar Jul 22 '25 19:07 jb3