How to enable 'Debug' and 'Trace' logging for users from plugin code?

I want to enable Debug and Trace log levels for users by programmatically from plugin code.

Is there a way to achieve this within the plugin code itself?

I see that users can manually configure it by navigating to Help → Diagnostic Tools → Debug Log Settings ..., and adding the required debug instructions (Java package name and log level), and clicking 'OK'.

However, I would like to automate this within the plugin code.

I would appreciate any feedback or solutions

1 Like

I’m curious about this too; did you find a solution?

I see that there are system properties we could probably change in code (Testing FAQ | IntelliJ Platform Plugin SDK), but perhaps this isn’t recommended because it may interfere with log settings of other plugins.

Maybe using Logger.getFactory().getLoggerInstance(...).setLevel(LogLevel.TRACE);

1 Like

You can find the sources of this action on intellij-community repository

Thanks! I ended up using this. Note that choosing a logger instance with a project-level name (“com.example”) allowed me to change the log level of all of my classes at once.