What should my plugin log?

Andrew Ardill
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2011

Are there any guidelines as to what my plugin should log, and at what level?

The logs can be really useful while I am debugging, but most of them are useless once the plugin is working. Is there an easy way to turn the amount logged up and down?

7 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

6 votes
Answer accepted
CharlesA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2011

The logging guidelines for Confluence development can be found on cac. Most of it is pretty general and can be applied just as well to plugins.

http://confluence.atlassian.com/display/CONFDEV/Logging+Guidelines

The most important thing to take away from that page about log levels is:

The standard Confluence log (level WARN) is a way for Confluence to communicate with the server administrator. Anything we log to this file will worry the administrator in some way. Logging at WARN level and higher should be reserved for situations that require some kind of attention from the server administrator, and for which corrective action is possible.

We should assume that any time Confluence logs a WARN level message or higher, the customer will create a support case, and will expect us to provide a solution that prevents that message from happening again.

2 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2011

My opinion on this is to write your code with the appropriate log levels, meaning DEBUG level logs for debugging. When you're debugging, you can turn up the log level by adding your package or class name to /confluence/WEB-INF/classes/log4j.properties, or you can add the package in the UI at Administration >> Logging. Read up at log4j Logging Levels and Configuring Logging. It's better to do it in log4j.properties - that way it persists when you restart.

An example would look like:

log4j.logger.com.jeremyplugin.ExampleMacro=DEBUG

1 vote
MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2011

I tend to use WARN for plugins unless they really do cause a real ERROR that will stop JIRA. This helps avoid automated log checkers sending out warnings to IT staff.

~Matt

0 votes
Andrew Ardill
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2011

That will be very helpful. You need to stop doing useful things, your karma is already high enough ;)

0 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2011

We're working on a tag wizard for the ask question page. You'll be able to uncheck it once you know your way around, but for new questions it should help, hopefully.

0 votes
Andrew Ardill
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2011

Sounds great - maybe this information should be added to the FAQ? Otherwise I can ask a meta-question about how to increase the visibility of my questions.

0 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2011

Hi Andrew, I retagged your question. We're putting all development questions under <product>-development.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events