JIRA plugin logging - how?

SarahL October 30, 2012

Hi,

I am developing a JIRA plugin and would like to be able to log something for debugging. I use the atlas-run JIRA runtime to test my plugin. I added a logger like this:

private static final Logger log = Logger.getLogger(MyCondition.class);

Then I enabled my logger in the JIRA administration (http://localhost:2990/jira/secure/admin/ViewLogging.jspa) with adding it like this:

my.package.MyCondition

and setting it to "DEBUG".

But I still get no output whatsoever - neither on the console nor in the atlassian-jira.log.

What am I doing wrong? Is there another way to log the output of a plugin in JIRA?

Thanks so much in advance!

Regards, Sarah

3 answers

0 votes
Adrian Terwedow February 12, 2013

Sorry for digging corpses but I just came across a similar problem while writing a plugin for Confluence 4.3 with the plugin SDK 4.1.4.

This problem will occur when there's already a log4j.properties file in the <plugin-root>/target/container/tomcat6x/lib directory. If so, other properties files will be ignored.
The solution then is either to use this properties file or to just delete or better move it to the <plugin-root>/src/main/resources directory which should be the default dir for plugin projects - at least when compared to the settings in most tutorials.

Maybe this will safe someone some time.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2012

You still have to explicitly write to the log - does your code run any

log.debug("I have a messinge, captin" );

type lines?

SarahL November 4, 2012

I do use log-methods like this:

log.debug("debug");
log.info("info");

I added this to all plugin methods, but no output anywhere :/

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 4, 2012

Ok, that's a good start - is your logging definitely in a place that it will be executed if the code is run?

I think you've got the system logging right (adding the package to the logging page and setting it to debug).

I have a feeling that you might want to add the logging in everywhere, including the constructor - I seem to remember that conditions and validators don't execute quite the way you'd expect, so it's worth adding extra logging to find out where they are actually being triggered. The logs should definitely go to atlassian-jira.log, but that can be very wordy, so I usually put in something distinctive (e.g. "Mr Flibble doesn't like this condition", then search the log for "Flibble")

Suggest an answer

Log in or Sign up to answer