I upgraded Log4j
from 2.9.1
to 2.13.2
. After upgrade lot of unnecessary logs are being shown while starting tomcat
server.
DEBUG StatusLogger Using ShutdownCallbackRegistry class org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
DEBUG StatusLogger Took 0.319733 seconds to load 239 plugins from ParallelWebappClassLoader
context: ROOT
delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@6d78f375
DEBUG StatusLogger PluginManager 'Converter' found 46 plugins
DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger Starting LoggerContext[name=531f4093, org.apache.logging.log4j.core.LoggerContext@144283f3]...
DEBUG StatusLogger Reconfiguration started for context[name=531f4093] at URI null (org.apache.logging.log4j.core.LoggerContext@144283f3) with optional ClassLoader: null
INFO StatusLogger Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=StatusLogger'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=ContextSelector'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=Loggers,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=Appenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=AsyncAppenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=AsyncLoggerRingBuffer'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=531f4093,component=Loggers,name=*,subtype=RingBuffer'
How to trun of all of these loggings?
My log4j
looks like
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<!-- ********************** Concole **************************-->
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%t %d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
<ThresholdFilter level="OFF"/>
</Console>
<!-- other file appenders and loggers-->
<!-- ********************************* Root ************************************ -->
<Root level="INFO">
<AppenderRef ref="console"/>
<AppenderRef ref="async_file"/>
<AppenderRef ref="async_errors_file" level="WARN"/>
</Root>
</Loggers>
</Configuration>
I tried with <Configuratin status="WARN/OFF">
but did not work.
I have following dependencies
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
Please suggest what is the fix for this?
From Log4j
doc:
From log4j-2.9 onward, log4j2 will print all internal logging to the console
if system property log4j2.debug is defined (with any or no value).
Check if you declare -Dlog4j2.debug
or -Dlog4j.debug
something like this. In my case, as they mentioned in doc it has no value and I changed it to -Dlog4j.debug="ERROR"
. Now, issue resolved and no internal logs are being printed.