let say I have this code:
public static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static void main(String[] args) {
LOGGER.info("Hi !");
}
But the output in console is this:
[main] INFO com.sirma.itt.javacourse.logger.example - Hi !
I would like to customize or edit the output. I do not need this "package information". So it would looks like this:
[main] - Hi !
or just:
Hi !
So what I did: 1. In parent pom I switched the defauld slf4j dependency with:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
2. In src/main/resources I created a file with name logback.xml and enter these settings:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%thread] %-5level - %msg%n</pattern>
</encoder>
</appender>
<logger name="deng" level="DEBUG" />
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>