我尝试编写一个 http 服务器,并且我想按照建议进行回滚。但是,我写的verticles似乎不受我使用的logback.xml的控制。
然后我写了我能想到的最简单的 Verticle,但是我的 logback.xml 似乎完全不起作用。
这是我的示例verticle:
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.logging.SLF4JLogDelegateFactory;
public class SimplestVerticle extends AbstractVerticle {
private static final Logger LOGGER = LoggerFactory.getLogger(SimplestVerticle.class);
@Override
public void start(Future<Void> future) {
Future<Void> newFuture = Future.future();
LOGGER.debug("This is debug");
LOGGER.info("This is info");
LOGGER.error("This is error");
newFuture.setHandler(future);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>[xxx]</groupId>
<artifactId>[xxx]</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version> …Run Code Online (Sandbox Code Playgroud)