TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class
Asked Answered
K

3

5

When I launch any of my application, i receive a lot of these lines at console and logs:

TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.auth.api.SessionAgentImpl
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCloseableAgent
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCentral
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCloseHooksHandler
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.core.api.plugins.AbstractCorePlugin
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.config.api.ConfigImpl
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCentral
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCloseHooksHandler
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCloseableAgent
TRACE StatusLogger Log4jLoggerFactory.getContext() found anchor class com.example.api.AbstractCentral

Then these lines appear in logs again and again. It started after updating log4j version to 2.15.0 and greater.

Ever come across that?

Kile answered 18/1, 2022 at 15:31 Comment(1)
You must be running with log4j2.debug=true, hence the verbose output from the status logger.Tenedos
G
6

As commented by piotr-p-karwasz, you are most likely setting the system property log4j2.debug to true. Remove system property log4j2.debug or set it to false to disable. This fixed it for me.

Gravelly answered 17/2, 2022 at 8:47 Comment(3)
Could you please tell where to configure "log4j2.debug=false"? Is it in log4j2.xml? I could not find this parameter in log4j2.xml which means it is not present but still getting these TRACE messages (assuming that this parameter needs to be present in log4j2.xml).Lush
It is a system property, so it might be set by the script that starts your application or as part of your build system. In my case, it was set in the Gradle script using the systemProperty method.Gravelly
Thanks. I figured this out. In our case, we are exposing log4j2.xml configuration, common.runtime.properties and jvmOptions via helm's values.yaml. The entire content of these helm variables then get updated to respective location inside druid processes's container like coordinator. This is how we have exposed jvmOptions in values.yaml. (5th parameter) jvmOptions: |- -server -XX:MaxDirectMemorySize=10240g -Duser.timezone=UTC -Dfile.encoding=UTF-8 -Dlog4j2.debug=false -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Djava.io.tmpdir=var/tmpLush
S
4

If you are using IntelliJ, you can modified "enable debug output" select box via run/debug configuration to decide trace logger display on console

Sochor answered 14/2, 2022 at 4:14 Comment(0)
R
0

Although the answers the question why these lines shows up in the log. The reason this log shows up because log4j config was not found in the first place in my experience.

Respiratory answered 1/12, 2022 at 18:32 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Dietsche

© 2022 - 2024 — McMap. All rights reserved.