How to make my custom app's logs appear in atlassian-jira.log?

Hi there,

I have a custom servlet filter app, which I have uploaded to my Jira instance.

It features some logging:

I import the following at the top of my app:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

I define my log inside the servlet filter class:

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

and then I log in the following way:

log.warn("My custom application log message");

This being the case, should I expect to see logs from this application appearing in my atlassian-jira.log file? This doesn’t seem to be the case. Are there extra steps that I have missed?

Many thanks!

1 Like

Hi Magnus,

I think you have to change the logging level => Change logging levels in Jira Server | Jira | Atlassian Documentation

Default level is ERROR. So just to be sure (and for initial debugging) try to use log.error instead of log.warn

Regards,
Christian

Thanks for coming back to me Christian.

Understood re: Logging levels. My app doesn’t appear in the list on the logging and profiling page.

Am I right in thinking I should manually add my app via the ‘Configure logging level for another package’ link, where I should enter the app key for my custom app?

I realise that this change would not persist after a host restart, but it would be a great first step if it can get my app logging to the default log file.

You’ve set this up right. Is your servlet being created/instantiated in the first place?

Hi Steve,

Yes - I’ve uploaded the app and it is performing as expected.

Hello Magnus,

Check the Documentation i have posted before. In the screenshot you can see it:

Default Loggers
Note that any changes you make here are not persisted across server restarts.
You will need to edit ‘WEB-INF/classes/log4j.properties’ to change levels permanently.

=> Logging and profiling | Administering Jira applications Data Center and Server 9.1 | Atlassian Documentation

Regards,
Christian

Many thanks for all the help on this one.

The solution turned out to be defining an output in the pom file, as described here: Logging to atlassian-confluence.log with log4j from plug-in running Confluence 7.0.1 from the SDK - #5 by viqueen