log4j2 shuts down all appenders with slf4j - java

I could use some help with my log4j2 configuration. When I debug the logger, it looks like it shuts down all of the appenders, and then I never receive any application logs. Luckily I know that log4j is at least finding the properties file and giving logger initialization debug output.
Here is my log4j2.properties file:
status = debug
name = PropertiesConfig
filters = threshold
filter.threshold.type = ThresholdFilter
filter.threshold.level = info
appenders = console
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yy-MM-dd HH:mm:ss:SSS} %-5p %c{1}:%L - %m%n
rootLogger.level = debug
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT
appender.file.type = File
appender.file.name = application
appender.file.fileName=${filename}/propertieslogs.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
Here is the logger debug init output:
DEBUG Starting LoggerContext[name=ROOT] from configuration at null
DEBUG Starting LoggerContext[name=ROOT, org.apache.logging.log4j.core.LoggerContext#448dc39b] with configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4...
DEBUG Shutdown hook enabled. Registering a new one.
DEBUG Apache Log4j Core 2.11.1 initializing configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4
DEBUG Installed 1 script engine
DEBUG Oracle Nashorn version: 1.8.0_162, language: ECMAScript, threading: Not Thread Safe, compile: true, names: [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], factory class: jdk.nashorn.api.scripting.NashornScriptEngineFactory
DEBUG PluginManager 'Core' found 118 plugins
DEBUG PluginManager 'Level' found 0 plugins
DEBUG PluginManager 'Lookup' found 14 plugins
DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
DEBUG PluginManager 'TypeConverter' found 26 plugins
DEBUG createAppenderRef(ref="STDOUT", level="null", Filter=null)
DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={STDOUT}, ={}, Configuration(PropertiesConfig), Filter=null)
DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
DEBUG createLoggers(={root})
DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
DEBUG PatternLayout$Builder(pattern="%d{yy-MM-dd HH:mm:ss:SSS} %-5p %c{1}:%L - %m%n", PatternSelector=null, Configuration(PropertiesConfig), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
DEBUG PluginManager 'Converter' found 44 plugins
DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
DEBUG ConsoleAppender$Builder(target="null", follow="null", direct="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d{yy-MM-dd HH:mm:ss:SSS} %-5p %c{1}:%L - %m%n), name="STDOUT", Configuration(PropertiesConfig), Filter=null)
DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
DEBUG createAppenders(={STDOUT})
DEBUG Building Plugin[name=filter, class=org.apache.logging.log4j.core.filter.ThresholdFilter].
DEBUG createFilter(level="INFO", onMatch="null", onMismatch="null")
DEBUG Configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4 initialized
DEBUG Starting configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4
DEBUG Started configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4 OK.
DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
DEBUG Appender DefaultConsole-1 stopped with status true
DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#605d8cc OK
DEBUG Registering MBean org.apache.logging.log4j2:type=ROOT
DEBUG Registering MBean org.apache.logging.log4j2:type=ROOT,component=StatusLogger
DEBUG Registering MBean org.apache.logging.log4j2:type=ROOT,component=ContextSelector
DEBUG Registering MBean org.apache.logging.log4j2:type=ROOT,component=Loggers,name=
DEBUG Registering MBean org.apache.logging.log4j2:type=ROOT,component=Appenders,name=STDOUT
DEBUG org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
DEBUG LoggerContext[name=ROOT, org.apache.logging.log4j.core.LoggerContext#448dc39b] started OK with configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4.
DEBUG Log4jServletContextListener ensuring that Log4j starts up properly.
DEBUG Log4jServletContextListener ensuring that Log4j shuts down properly.
DEBUG Removing LoggerContext for [ROOT].
DEBUG Stopping LoggerContext[name=ROOT, org.apache.logging.log4j.core.LoggerContext#448dc39b]...
DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false
DEBUG Shut down OutputStreamManager SYSTEM_OUT.false.false, all resources released: true
DEBUG Appender STDOUT stopped with status true
DEBUG Stopped org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#70ffa0b4 OK
DEBUG Stopped LoggerContext[name=ROOT, org.apache.logging.log4j.core.LoggerContext#448dc39b] with status true
Thanks for any help! I need it.
I'd really like to get the async appenders working at some point, but its hard to find examples via the log4j2.properties syntax for log4j2
P.S. - here is my pom.xml:
<!-- log4j is used for logging within the application -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.11.1</version>
<scope>runtime</scope>
</dependency>
<!-- slf4j is used to tie Spring to log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>

I just experienced what seems to be a similar problem. In my case, I was able to receive application logs, but with what appeared to be a default log4j2 config. The logs were INFO level. None of the levels set for loggers in the log4j2 config (XML) were being applied. I saw a very similar output in the startup logs as posted by the OP, including the message about "shutting down OutputStreamManager".
Mine is a spring-boot application and I was able to resolve the problem by disabling the spring-boot LoggingSystem. I added this system variable to my startup command:
-Dorg.springframework.boot.logging.LoggingSystem=none
Once I did that, the logging worked as expected, according to the levels set in my log4j2 XML config. It appears to be spring-boot hijacking the log system, rather than a conflict between SLF4J an LOG4J2.
Note that I still see the same logging startup messages -- the OutputStreamManager is still shutting down. Speculation: this is normal behavior, possibly just shutting down the bootstrap logger that prints the log4j2 initialization process.
Versions:
log4j: 2.13.3
slf4j: 1.7.30
spring-boot: 2.2.7-RElEASE

Related

Struggling sending e-mails with log4j2 and SMTP Appender

I'm completely new to springboot and log4j2, and I cannot manage to send e-mail for a certain type of log (Warn&Error). I dont' understand why i get "ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.SmtpAppender" message. Does anyone have a clue?
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configuration SYSTEM "log4j2.dtd">
<Configuration status="debug" monitorInterval="30">
<Appenders>
<SMTP name="Mailer" subject="Error Log" to="email#email.com"
from="email2#email.com"
smtpHost="host" smtpUsername="username"
smtpPassword="mdp" smtpProtocol="smtp"
bufferSize="50">
<HtmlLayout />
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c:%L - %m%n" />
</SMTP>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Mailer" />
</Root>
</Loggers>
</Configuration>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>smtp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>smtp</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
SmtpApplication.java
package com.example.smtp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SmtpApplication {
private static final Logger logger = LogManager.getLogger(SmtpApplication.class);
public static void main(String[] args) {
SpringApplication.run(SmtpApplication.class, args);
logger.debug("Debugging log");
logger.info("Info log");
logger.warn("Hey, This is a warning!");
logger.error("Oops! We have an Error. OK");
logger.fatal("Damn! Fatal error. Please fix me.");
}
}
LOG
2023-01-24 17:30:17,730 main DEBUG AsyncLogger.ThreadNameStrategy=UNCACHED (user specified null, default is UNCACHED)
2023-01-24 17:30:17,731 main DEBUG org.apache.logging.log4j.core.util.SystemClock supports precise timestamps.
2023-01-24 17:31:47,540 Log4j2-TF-4-Scheduled-2 INFO Source 'C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml' was modified on Tue Jan 24 17:31:33 CET 2023 (1674577893351), previous modification was on Tue Jan 24 17:29:57 CET 2023 (1674577797490)
2023-01-24 17:31:47,542 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Reconfiguration started for context 6d5380c2 (org.apache.logging.log4j.core.LoggerContext#7674b62c)
2023-01-24 17:31:47,544 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Lookup' found 17 plugins
2023-01-24 17:31:47,546 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Closing FileInputStream java.io.FileInputStream#465ecc51
2023-01-24 17:31:47,550 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Watching configuration 'C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml' for lastModified Tue Jan 24 17:31:33 CET 2023 (1674577893351)
2023-01-24 17:31:47,552 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Apache Log4j Core 2.19.0 initializing configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,553 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Core' found 131 plugins
2023-01-24 17:31:47,554 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Level' found 0 plugins
2023-01-24 17:31:47,554 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Lookup' found 17 plugins
2023-01-24 17:31:47,556 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.HtmlLayout].
2023-01-24 17:31:47,557 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG HtmlLayout$Builder(locationInfo="null", title="null", contentType="null", charset="null", fontSize="null", fontName="null", datePattern="null", timezone="null")
2023-01-24 17:31:47,557 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2023-01-24 17:31:47,558 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PatternLayout$Builder(pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c:%L - %m%n", PatternSelector=null, Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
2023-01-24 17:31:47,558 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Converter' found 48 plugins
2023-01-24 17:31:47,559 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.SmtpAppender].
2023-01-24 17:31:47,561 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG SmtpAppender$Builder(to="email#email.com", cc="null", bcc="null", from="email2#email.com", replyTo="null", subject="Error Log", smtpProtocol="smtp", smtpHost="host", smtpPort="null", smtpUsername="username", smtpPassword="*****", smtpDebug="null", bufferSize="50", SSL=null, ignoreExceptions="null", HtmlLayout(org.apache.logging.log4j.core.layout.HtmlLayout#42614042), name="Mailer", Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Filter=null, ={})
2023-01-24 17:31:47,563 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR appender SMTP has no parameter that matches element PatternLayout
2023-01-24 17:31:47,566 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.SmtpAppender for element SMTP: java.lang.NoClassDefFoundError: javax/mail/MessagingException java.lang.NoClassDefFoundError: javax/mail/MessagingException
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.lambda$build$0(SmtpAppender.java:288)
at java.base/java.util.Optional.orElseGet(Unknown Source)
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.build(SmtpAppender.java:288)
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.build(SmtpAppender.java:92)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:757)
at org.apache.logging.log4j.core.util.AbstractWatcher$ReconfigurationRunnable.run(AbstractWatcher.java:93)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
2023-01-24 17:31:47,571 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.SmtpAppender for element SMTP: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.SmtpAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.SmtpAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:260)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:757)
at org.apache.logging.log4j.core.util.AbstractWatcher$ReconfigurationRunnable.run(AbstractWatcher.java:93)
at java.base/java.lang.Thread.run(Unknown Source)
2023-01-24 17:31:47,575 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2023-01-24 17:31:47,577 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Null object returned for SMTP in Appenders.
2023-01-24 17:31:47,579 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createAppenders(={})
2023-01-24 17:31:47,580 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2023-01-24 17:31:47,581 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createAppenderRef(ref="Mailer", level="null", Filter=null)
2023-01-24 17:31:47,581 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2023-01-24 17:31:47,582 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG LoggerConfig$RootLogger$Builder(additivity="null", level="INFO", levelAndRefs="null", includeLocation="null", ={Mailer}, ={}, Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Filter=null)
2023-01-24 17:31:47,583 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2023-01-24 17:31:47,584 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createLoggers(={root})
2023-01-24 17:31:47,585 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Unable to locate appender "Mailer" for logger config "root"
2023-01-24 17:31:47,586 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] initialized
2023-01-24 17:31:47,587 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Starting configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,588 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4j2 ConfigurationScheduler starting 1 threads
2023-01-24 17:31:47,589 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Started configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] OK.
2023-01-24 17:31:47,590 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propertyChange(): java.beans.PropertyChangeEvent[propertyName=config; oldValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; newValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; propagationId=null; source=org.apache.logging.log4j.core.LoggerContext#7674b62c]
2023-01-24 17:31:47,591 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propagateLogLevels(): XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,593 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4j2 ConfigurationScheduler shutting down threads in java.util.concurrent.ScheduledThreadPoolExecutor#6302a2c0[Running, pool size = 1, active threads
= 0, queued tasks = 1, completed tasks = 3]
2023-01-24 17:31:47,595 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Stopped XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] OK
2023-01-24 17:31:47,596 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propertyChange(): java.beans.PropertyChangeEvent[propertyName=config; oldValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; newValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; propagationId=null; source=org.apache.logging.log4j.core.LoggerContext#7674b62c]
2023-01-24 17:31:47,599 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propagateLogLevels(): XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,602 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2
2023-01-24 17:31:47,603 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=StatusLogger
2023-01-24 17:31:47,604 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=ContextSelector
2023-01-24 17:31:47,606 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=Loggers,name=
2023-01-24 17:31:47,606 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Reconfiguration completed for 6d5380c2 (org.apache.logging.log4j.core.LoggerContext#7674b62c) in 65 milliseconds.
I've tried plenty of things, but cannot mannage du make it work. Does anyone avec a clue?
Your are facing one of the side-effects of the gap between Java EE 8 and Jakarta EE 9 (it's a very disruptive renaming of classes): Spring Boot 3.x contains an implementation of Jakarta Mail 2.0, while the SMTP appender in Log4j2 Core requires and implementation of Java Mail 1.6.
To fill the gap, we published an alternative implementation of MailManager (the engine behind the SMTP appender) in the log4j-jakarta-smtp artifact. To use it, you just need to add it to your runtime classpath:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jakarta-smtp</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta-activation</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.mail</groupId>
<artifactId>smtp</artifactId>
</exclusion>
</exclusions>
</dependency>
(the version is managed by Spring Boot).
Try replacing
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
with the following the dependencies
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>

log4j:WARN No appenders could be found for logger (org.springframework.web.filter.CharacterEncodingFilter). with log4j2

I am in the process of migrating from log4j 1.2 to log4j 2.
I have my whole configuration into a log4j2.properties file.
I noticed that I got a new error message in my logs while starting my tomcat :
log4j:WARN No appenders could be found for logger (org.springframework.web.filter.CharacterEncodingFilter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I have verified with my previous logs, and I did not have this warning previously.
Here is my previous configuration (in the log4j.properties file):
log4j.rootLogger=INFO, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd-MM HH:mm:ss} %p %t %c - %m%n
log4j.logger.com.example=DEBUG
log4j.logger.org.springframework=INFO
Here is the new one (in log4j2.properties) :
appender.console.type = Console
appender.console.name = ConsoleAppender
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d %p %t %c - %m%n
loggers = log1, log2
logger.log1.name = org.springframework
logger.log1.level = INFO
logger.log1.appenderRef = ConsoleAppender
logger.log2.name = com.example
logger.log2.level = DEBUG
logger.log2.appenderRef = ConsoleAppender
rootLogger.level = ERROR
rootLogger.appenderRef.stdout.ref = ConsoleAppender
So, what I've understand so far is :
I create one appender, named ConsoleAppender, of type Console
I create two loggers that goes each onto ConsoleAppender, one on org.springframework (level INFO) and the other on com.example (level INFO)
I use this page to try to understand how to do the migration.
Do you see any explanation about why I should have this particular message ?
As seen in this answer, the issue may be due to the fact that I was also using slf4j-log4j12 (but in the latest version already) and it was in conflict with other log4j apis :
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
So I did what's told and I removed the org.slf4j:slf4j-log4j12 dependancy and added log4j-api & log4j-slf4j-impl dependancies :
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.8.2</version>
</dependency>
... and for know it seems to solve the error (it doesn't appear anymore into my starting logs
To be more clear, I first only added the three above dependancies without removing the slf4j-log4j12 one, and I got this as well into the logs :
SLF4J: Found binding in
[jar:file:/myuser/apache-tomcat-7.0.75/webapps/mywebapp/WEB-INF/lib/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/myuser/apache-tomcat-7.0.75/webapps/mywebapp/WEB-INF/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
After having removed the slf4j-log4j12 dependancy, the whole error logs disappeared.

Why Log files have lots of NUL characters?

The problem:
185 INFO [2016-07-20 08:24:50,393] ({RemoteInterpreter async opener} RemoteInterpreter.java[open]:115) - Create remote interpreter org.apache.zeppelin.spark.SparkInterpreter
186 INFO [2016-07-20 08:24:50,437] ({qtp691447552-1500} NotebookRestApi.java[getJobs]:163) - getjobs user ***#***.com, productUser mamm01
187 INFO [2016-07-20 08:25:05,765] ({qtp691447552-1483} NotebookRestA^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^# INFO [2016-07-20 08:25:50,143] ({qtp691447552-1500} NotebookRestApi.java[bind]:119) - binding user ***#***.com to settingId ***#***.com-__-mamm01-__-21
188 INFO [2016-07-20 08:25:50,146] ({RemoteInterpreter async opener} RemoteInterpreterProcess.java[reference]:103) - Run interpreter process [/home/hadoop/zeppelin/zeppelin-0.5.6-incubating/bin/interpreter.sh, -d, /home/hadoop/zeppelin/zeppelin-0.5.6-incubating/interpreter/spark, -p, 35297]
'^#' is '\0'(NUL) in the vim editor. Line 187 is incomplete. the last part is lost and overwrited with '\0'. There are many places in my log file looks like that. It's so weird.
My log4j.properties:
log4j.rootLogger = INFO, dailyfile
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
log4j.appender.dailyfile.DatePattern=.yyyy-MM-dd
log4j.appender.dailyfile.Threshold = INFO
log4j.appender.dailyfile = org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyfile.File = ${zeppelin.log.file}
log4j.appender.dailyfile.layout = org.apache.log4j.PatternLayout
log4j.appender.dailyfile.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
log4j.appender.dailyfile.Append=true
log4j.appender.dailyfile.ImmediateFlush=true
I tried to set Append and ImmediateFlush to true, but it doesn't help.
My pom.xml:
<slf4j.version>1.7.21</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
I tried to update slf4j and log4j version, but it doesn't help.
My pattern of calling slf4j API:
public class NotebookRestApi {
private static final Logger LOG = LoggerFactory.getLogger(NotebookRestApi.class);
...
LOG.info("binding user {} to settingId {}", email, settingId(email, product, hiveSiteId));
My Application uses JAX-RS and embedded jetty, I don't know if it's related to the problem. My another suspicion is, Is it possible caused by multiple classloaders?

Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout

I am trying to log in JSON format through log4j2.
This is my log4j2.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug" name="MyApp" packages="org.apache.logging.log4j.core.layout.JSONLayout">
<Appenders>
<RollingRandomAccessFile name="RollingRandomAccessFile" fileName="logs/app3.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz" append="false">
<JsonLayout/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="trace">
<AppenderRef ref="RollingRandomAccessFile"/>
</Root>
</Loggers>
</Configuration>
These are the dependencies I have used:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>net.logstash.log4j</groupId>
<artifactId>jsonevent-layout</artifactId>
<version>1.7</version>
</dependency><dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
When I run the program I get an error as follows:
543 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout.
Debug:
2016-05-09 16:06:04,909 main DEBUG Initializing configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml]
2016-05-09 16:06:04,916 main DEBUG Installed script engines
2016-05-09 16:06:05,717 main DEBUG Oracle Nashorn Version: 1.8.0_91, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-05-09 16:06:05,823 main DEBUG Took 0.104995 seconds to load 14 plugins from package org.apache.logging.log4j.core.layout
2016-05-09 16:06:05,824 main DEBUG PluginManager 'Core' found 97 plugins
2016-05-09 16:06:05,824 main DEBUG PluginManager 'Level' found 0 plugins
2016-05-09 16:06:05,831 main DEBUG No scheduled items
2016-05-09 16:06:05,835 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-05-09 16:06:05,837 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.JsonLayout].
2016-05-09 16:06:05,853 main DEBUG PluginManager 'TypeConverter' found 23 plugins
2016-05-09 16:06:05,863 main DEBUG createLayout(locationInfo="false", properties="false", complete="false", compact="false", eventEol="false", charset="UTF-8")
2016-05-09 16:06:05,864 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JSONLayout.
2016-05-09 16:06:05,865 main DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
2016-05-09 16:06:05,867 main DEBUG createPolicy(interval="null", modulate="null")
2016-05-09 16:06:05,868 main DEBUG Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
2016-05-09 16:06:05,869 main DEBUG createPolicy(size="250 MB")
2016-05-09 16:06:05,872 main DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
2016-05-09 16:06:05,882 main DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=262144000)})
2016-05-09 16:06:05,882 main DEBUG Building Plugin[name=DefaultRolloverStrategy, class=org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy].
2016-05-09 16:06:05,887 main DEBUG createStrategy(max="20", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="true", Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml))
2016-05-09 16:06:05,888 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender].
2016-05-09 16:06:05,892 main DEBUG createAppender(fileName="logs/app3.log", filePattern="logs/${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz", append="false", name="RollingRandomAccessFile", immediateFlush="null", bufferSize="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=262144000)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=20)), JSONLayout(null), Filter=null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml))
2016-05-09 16:06:05,893 main INFO 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.
2016-05-09 16:06:05,894 main DEBUG PluginManager 'Converter' found 38 plugins
2016-05-09 16:06:05,895 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2
2016-05-09 16:06:05,909 main DEBUG Starting RollingRandomAccessFileManager logs/app3.log
2016-05-09 16:06:05,914 main DEBUG PluginManager 'FileConverter' found 2 plugins
2016-05-09 16:06:05,935 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-05-09 16:06:05,936 main DEBUG createAppenders(={RollingRandomAccessFile})
2016-05-09 16:06:05,936 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-05-09 16:06:05,937 main DEBUG createAppenderRef(ref="RollingRandomAccessFile", level="null", Filter=null)
2016-05-09 16:06:05,937 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2016-05-09 16:06:05,938 main DEBUG createLogger(additivity="null", level="TRACE", includeLocation="null", ={RollingRandomAccessFile}, ={}, Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml), Filter=null)
2016-05-09 16:06:05,941 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-05-09 16:06:05,943 main DEBUG createLoggers(={root})
2016-05-09 16:06:05,944 main DEBUG Configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml] initialized
2016-05-09 16:06:05,952 main DEBUG Starting configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml]
2016-05-09 16:06:05,952 main DEBUG Started configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml] OK.
2016-05-09 16:06:05,953 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1
2016-05-09 16:06:05,953 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#7de26db8 OK
2016-05-09 16:06:06,027 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e
2016-05-09 16:06:06,030 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=StatusLogger
2016-05-09 16:06:06,032 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=ContextSelector
2016-05-09 16:06:06,034 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=Loggers,name=
2016-05-09 16:06:06,036 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=Appenders,name=RollingRandomAccessFile
2016-05-09 16:06:06,041 main DEBUG Reconfiguration complete for context[name=1a6c5a9e] at URI /home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml (org.apache.logging.log4j.core.LoggerContext#732c2a62) with optional ClassLoader: null
2016-05-09 16:06:06,041 main DEBUG Shutdown hook enabled. Registering a new one.
16-05-09 16:06:06,043 main DEBUG LoggerContext[name=1a6c5a9e, org.apache.logging.log4j.core.LoggerContext#732c2a62] started OK.
Is there a dependency I am missing out or this some other problem? Please suggest possible things I can try for solving this problem. If you know a better solution to write logs in Logstash Json format you may suggest.
I suspect you are missing one of the Jackson dependencies.
You have jackson-core-asl, I think you need these three:
com.fasterxml.jackson.core:jackson-core:jar:2.6.3
com.fasterxml.jackson.core:jackson-databind:jar:2.6.3
com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0
The ultimate source of truth for dependencies is the dependency tree of the Log4j 2 implementation module.
You may be able to get more details on the problem by setting <Configuration status="debug" ... in your configuration.

IBM RTC Logging SDK in Java with Spring Boot

When using the RTC SDK normally in an application, I can turn off the logging in that layer using Log4j with the following code:
// Only show warnings for IBM dependencies
Logger.getLogger("com.ibm").setLevel(Level.WARN);
Logger.getLogger("com.ibm").setAdditivity(false);
Logger.getRootLogger().setLevel(Level.DEBUG);
When trying to convert over to SpringBoot, I add just the basic SpringBoot package and I get all sorts of debug information from the RTC SDK. Even if I have only the root logger set to FATAL and have not settings anywhere else for logging.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.3.2.RELEASE</version>
</dependency>
As soon as I add the dependency, (without even having the #SpringBootApplication annotation or even SpringApplication.run(Main.class, args), it starts spewing out RTC log information like the following:
16:14:20.161 [main] DEBUG c.i.t.r.c.i.u.InternalTeamPlatform - Thread[main,5,main]
16:14:20.164 [main] DEBUG c.i.t.r.c.i.u.InternalTeamPlatform - start asBundlefalse
16:14:20.164 [main] DEBUG c.i.t.r.c.i.u.InternalTeamPlatform - set start true
16:14:22.387 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Entering setCredentials(userid=, password=)
16:14:22.387 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Entering closeHttpClient
16:14:22.387 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Value of _httpclient: null
16:14:22.408 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - httpclient already closed
16:14:22.410 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Entering createTeamService
16:14:22.410 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - creating RemoteTeamService from com.ibm.team.repository.common.internal.IRepositoryRemoteService
16:14:22.420 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Entering createTeamService
16:14:22.420 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - creating RemoteTeamService from com.ibm.team.repository.common.service.IQueryService
16:14:22.424 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - Entering createTeamService
16:14:22.424 [main] DEBUG c.i.t.r.t.client.RemoteTeamServer - creating RemoteTeamService from com.ibm.team.repository.common.service.IExternalUserRegistryService
My question is, how can I turn this excess logging off? It is quite annoying and not useful to me.
As my colleague suggested in his comment:
you have to include this inside of your pom underneath the dependency tag:
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>

Categories

Resources