Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Logging and profiling meaning of %q{2}

BDOU
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2017

Hi Community,

While configuring logging options in Jira Software recent versions (7.1.9 and latest) to prepare and test migration on referenced JIRA instance, We face an unknown log4j pattern in the default log4j.properties file ship with JIRA Software (Zip packages for standalone).

Extract (line 62) of log4j.properties is :


log4j.appender.filelog.layout.ConversionPattern=%d %t %p %X{jira.username} %X{jira.request.id} %X{jira.request.assession.id} %X{jira.request.ipaddr} %X{jira.request.url} [%q{2}] %m%n

Apache log4j documentation has no reference of [%q{2}] pattern (https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout).\\

Can one please explain that pattern or point out a web link to a reference where the meaning and the description of this pattern ?

Thank you for reading and helping me.

3 answers

0 votes
Markus Kokott February 25, 2025

%q{2} means, you take the name of the logger (like %c does) and you truncate all package parts to the first letter except for the last 2 parts followed by the class name.

For example, foo.bar.baz.qux.MyClass becomes f.b.baz.qux.MyClass.

0 votes
Sebastian April 3, 2020

It seems to be what you configure in log4JLogger: 

logger = Logger.getLogger("MyLogger")

 In this example it would add a [MyLogger] to every log

That is what I understood...

0 votes
Boris Berenberg - Atlas Authority
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.
December 11, 2017

milliseconds as decimal I believe

BDOU
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2017

Thank you Boris for your answer but it seems to be more like a custom pattern as nor Log4j neither SLF4j use the %q char.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events