Duplicate statements in logger for same action after action tracing turned on

book

Article ID: 192124

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

STEPS TO REPRODUCE

1. Log into Clarity PPM NSA.
2. Click the the Server properties button.
3. Select the Logs tab then Edit Configuration.
4. Tick the 'Detect Log Configuration Changes Automatically' option on
5. Set the category priority level to Warn for categories such as trace.server and trace.server.user.admin.
6. Save the changes

Expected Results: In the logger file we expect to one statement 
Actual Results: In the logger file we see same action repeated twice 

Cause

If the logger has appender associated with it then it writes the log and passes the event to its parent logger. If the parent logger also has an appender associated, then it also writes the log and the same continues up in the hierarchy until a parent logger is found without any appender or root logger is reached.




 

Resolution

To stop propagating the event to parent, the ‘additive’ property of the logger can be set to false.

Additional Information

Here is the documentation related to this property

https://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity

Unchecking the additive check box from nsa for “trace.server.selective.user” logger (parent logger: “trace.server”) and found that the duplicate logs are no longer written in trace file.