Skip to content

Commit

Permalink
switch from simple log4j to logback
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Aug 3, 2021
1 parent 71396f6 commit 80e072e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
33 changes: 33 additions & 0 deletions leshan-client-demo/logback-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013-2015 Sierra Wireless and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v20.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.html.
Contributors:
Sierra Wireless - initial API and implementation
-->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p %C{0} - %m%n</pattern>
</encoder>
</appender>

<root level="WARN">
<appender-ref ref="STDOUT" />
</root>

<logger name="org.eclipse.leshan" level="INFO" />
<logger name="org.eclipse.leshan.core.californium.LwM2mCoapResource" level="DEBUG"/>
<logger name="org.eclipse.leshan.server.security.SecurityCheck" level="DEBUG" />
<logger name="org.eclipse.leshan.server.bootstrap.DefaultBootstrapHandler" level="DEBUG" />
<logger name="org.eclipse.leshan.core.model.LwM2mModel" level="DEBUG" />
</configuration>
10 changes: 5 additions & 5 deletions leshan-client-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Contributors:

<!-- runtime dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>

Expand All @@ -61,9 +61,9 @@ Contributors:
<mainClass>org.eclipse.leshan.client.demo.LeshanClientDemo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>../jar-with-dependencies-with-logback.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@

public class LeshanClientDemo {

static {
// Define a default logback.configurationFile
String property = System.getProperty("logback.configurationFile");
if (property == null) {
System.setProperty("logback.configurationFile", "logback-config.xml");
}
}

private static final Logger LOG = LoggerFactory.getLogger(LeshanClientDemo.class);
// /!\ This field is a COPY of org.eclipse.leshan.server.demo.LeshanServerDemo.modelPaths /!\
// TODO create a leshan-demo project ?
Expand Down
11 changes: 0 additions & 11 deletions leshan-client-demo/src/main/resources/simplelogger.properties

This file was deleted.

0 comments on commit 80e072e

Please sign in to comment.