I have a clean maven project and using lombok with this dependencies in my pom:
Edit: here is a sample project with the configurations I'm listing so you can take a look at it.
<!--region Lombok Configuration -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.8.0-beta2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<type>jar</type>
</dependency>
<!-- endregion -->
And 4 duplicated files placed in /src
and /src/main/resources
each:
- slf4j.properties=
- log4j.properties:
log4j.rootLogger=ERROR,stdout
log4j.logger.com.myorg=ERROR
log4j.logger.com.myorg.internal.myproj=ERROR
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n
- simplelogger.properties
org.slf4j.simpleLogger.defaultLogLevel=ERROR
- logback.xml
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="error">
<appender-ref ref="STDOUT" />
</root>
</configuration>
I put all the logs in ERROR
level so I will be able to just verify that the configuration files are being read, but when printing a single log for EVERY level, the console keeps printing the default level (INFO
, WARN
and ERROR
)
I assume that the no configuration file is being read/detected.
Which configuration file should I be using, and where should I place it for it to identify it? Or maybe I'm confused and we are not able to configure logs with this configuration and I should be looking into another implementation of lombok? I'm kind of lost in here.