How to show custom plugin logging options inside jira system admin panel

Hi, we are actually using log4j library in our custom plugin.

import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;


Class CustomClass{
private Logger _logger;


_logger = Logger.getLogger(CustomClass.class);
BasicConfigurator.configure();
_logger.setLevel(Level.WARN);
}

Using these configuration, the default verbosity is set to WARN, but it seems impossible to change it from Jira Administration Panel. We would like to show default verbosity level setting (and make out plugin appear in the list, if possible), to let eventually the final administrator set it.
I’ve tried also by using org.slf4j.Logger and also com.atlassian.extras.common.log.Logger but I couldn’t do it.
If possible I would avoid creating a custom log4j.properties
Thanks in advance for your support.

I would suggest switching to slf4j if you could (it’s what Atlassian is using everywhere).

The end users should be able to switch the debugging at runtime through the ui: https://confluence.atlassian.com/jirakb/how-to-set-logging-level-for-a-package-in-jira-629178605.html as long as they know the package name.

Now this gets reset on restarts - to make it permanent - they’d need to update the JIRA log4j configuration.

1 Like

I assume this is for during development when you don’t want to have to keep going in and changing the logging level each time you fire up a debug instance?

What we did at Adaptavist was to write a P2 plugin which we include as a PluginArtifact in our pom that sets the logging level for com.adaptavist.* to ALL on system startup. It’s a really simple plugin, just a component that grabs the logger and sets the levels so it’s a cross-product plugin that we can use with all atlassian apps.

It works well, and it’s also handy when you want a customer to up your logging levels since you just get them to install the plugin :slight_smile: