Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to disable Stack Trace in Confluence Log

Benjamin W_ July 15, 2019

Hello folks

in order to take care of issues with our Confluence installation (on Prem, 6.14.2) I want to get rid of unnecessary information in the log files. (e.g. Application Data\Confluence\logs\atlassian-confluence.log)

Especially the Stack Traces in the default extend are - in my point of view - not relevant for a system admin. On error in the log file generates up to 320 lines of stack trace. This makes the log very hard to read and analyze.

I have tried changing the parameters in the log4j.properties, but this has no impact on the stack trace itself, only on the items that occure in the log themselves.

I have searched the Web for a solution, but apart from a similiar question from 2016 in the community I was not able to find an answer. https://community.atlassian.com/t5/Confluence-questions/Disable-Stacktrace-information/qaq-p/318306

 

Therefor: how can the stack trace be reduced from 320 lines to e.g. five lines?

Thanks and regards, Benjamin

 

1 answer

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Dear @Benjamin W_ ,

have a look at this external article. It describes this in general for log4j - not specially for Confluence.

So long

Thomas

Benjamin W_ July 15, 2019

Hello @Thomas Deiler 

thank you very much for your fast feedback.

I followed on your hint regarding %throwable{n}. This exactly seems to do what I am looking for!
Unfortunately, I was not able to get this working as expected. From my understanding, %throwable{n} is falsely getting interpreted as %t, which refers to the causing Thread.

Step by step:

in log4j.properties I have enriched all the lines with ConversionPattern with %throwable{3}. So e.g.
log4j.appender.confluencelog.layout.ConversionPattern=%d %p [%c{4}] %M %m%n %throwable{3}

The stack trace is still shown at full extend.

I realized that the log is showing localhost-startStop-1hrowable{3} which leads to my assumption that it is getting interpreted as %t + plain String hrowable{3}

I have tried the following variants, but all none with the expected result:
- surrounded with square brackets [%throwable{3}] (in order to make this a "single" statement)
- removed %t (in order to avoid conflict)
- put to the beginning of the ConversionPattern (before %d, in order to have this parsed first)
- instead of %throwable{3} use %throwable{short} (any other documented option instead of number)
- same for %throwable{none} (reason why see below)

From the official documentation, this option %throwable{n} is supported since log4j 1.2.16. I have verified that our Confluence installation has log4j-1.2.17.jar, which is also the latest release of log4j 1.x (stated here https://logging.apache.org/log4j/1.2/download.html)

 

Interestingly, I found a discussion in the Jira Community dealing with Jira logs and Syslog-Server. (see here https://community.atlassian.com/t5/Jira-questions/Push-JIRA-logs-to-syslog-server/qaq-p/458074)
The explanations there contain the usage of %throwable{none}. 
So the usage of this parameter within the Atlassian universe seems to be common.
I have tried using %throwable{none}, but same result..

 

Am I missing something?

Thanks and Regards, Benjamin

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2019

Dear @Benjamin W_ ,

I am not fit enough any more for the details of Log4j. So please ask this specific question at https://community.developer.atlassian.com/ again.

So long

Thomas

Benjamin W_ July 23, 2019

Thanks for the suggestion - was not aware of this community.

Have placed it there. See here

Keep you posted.

Kurt Rosivatz April 30, 2021

I found a possible solution and posted it in the developer community and now here:

I got it to work so far, but did not dare to use it in production ...

Im using Confluence Server 7.4 LTS, in my log4j.properties, there is the line:

`log4j.appender.confluencelog.layout=com.atlassian.confluence.util.PatternLayoutWithContext`

It seems that Atlassians PatternLayoutWithContext does not support the %throwable Parameter for the layout. But org.apache.log4j.EnhancedPatternLayout does. So I changed the line to:

`log4j.appender.confluencelog.layout=org.apache.log4j.EnhancedPatternLayout`

And layout to:

`log4j.appender.confluencelog.layout.ConversionPattern=%d %p [%t] [%c{4}] %M %m%n %throwable{1}`

And that works fine - no long stack traces any more in the log files.

Regards,
Kurt

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events