Skip to content

Commit

Permalink
✨ mica-mqtt-example 使用 tinylog。
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunMengLu committed Sep 10, 2022
1 parent cd24411 commit 2b97778
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 31 deletions.
49 changes: 27 additions & 22 deletions example/mica-mqtt-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</parent>

<properties>
<log4j2.version>2.17.2</log4j2.version>
<graalvm.version>22.0.0.2</graalvm.version>
<mainClass.server>net.dreamlu.iot.mqtt.server.MqttServerTest</mainClass.server>
<mainClass.client>net.dreamlu.iot.mqtt.client.MqttClientTest</mainClass.client>
Expand All @@ -37,6 +36,10 @@
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
</build>

<profiles>
<profile>
<id>jar</id>
Expand All @@ -50,45 +53,47 @@
<artifactId>caffeine</artifactId>
<version>2.9.2</version>
</dependency>
<!-- 非 GraalVM 环境用 log4j2 -->
<!-- 非 GraalVM 环境用 tinylog -->
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>slf4j-tinylog</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
<groupId>org.tinylog</groupId>
<artifactId>tinylog-impl</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>${mainClass.server}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
writer = console
writer.format = {date: HH:mm:ss.SSS} [{thread}] {level} {class-name}.{method} : {message}
writer.level = info
# level
level@org.tio = warn
level@org.tio.client.TioClient = off
level@org.tio.server = info
level@net.dreamlu = info
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<fastjson.version>1.2.83</fastjson.version>
<micrometer-core.version>1.9.0</micrometer-core.version>
<jfinal.version>5.0.1</jfinal.version>
<tinylog.version>2.4.1</tinylog.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<lombok.version>1.18.24</lombok.version>
</properties>
Expand Down Expand Up @@ -111,6 +112,23 @@
<artifactId>mica-mqtt-client-spring-boot-starter</artifactId>
<version>${revision}</version>
</dependency>
<!-- tinylog 内存占用更小、性能更好,适合边缘设备 -->
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>slf4j-tinylog</artifactId>
<version>${tinylog.version}</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
<artifactId>tinylog-impl</artifactId>
<version>${tinylog.version}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down

0 comments on commit 2b97778

Please sign in to comment.