我想更改我的 Vert.x 应用程序中的默认日志级别,所以我在项目中添加了一个名为 vertx-default-jul-logging.properties 的配置文件,然后将其添加根文件夹作为类路径中的源文件夹,just like the documentation says .
文件内容如下:
handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
java.util.logging.SimpleFormatter.format=%5$s %6$s\n
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level=FINEST
java.util.logging.FileHandler.level=INFO
java.util.logging.FileHandler.formatter=io.vertx.core.logging.impl.VertxLoggerFormatter
# Put the log in the system temporary directory
java.util.logging.FileHandler.pattern=%t/vertx.log
.level=FINEST
io.vertx.ext.web.level=FINEST
io.vertx.level=FINEST
com.hazelcast.level=FINEST
io.netty.util.internal.PlatformDependent.level=FINEST
现在...这些都不起作用,日志级别没有一点变化;我看不到任何调试痕迹。
我做错了什么?
最佳答案
您需要将 vertx-default-jul-logging.properties 文件添加到/src/main/resources 文件夹,如 Marouane 状态。
如果您需要以编程方式更改,例如。您可以这样做的日志文件的位置:
String logFile = "/var/log/my-app.log";
System.setProperty("java.util.logging.FileHandler.pattern", logFile);
关于java - 通过添加配置文件更改 Vert.x 中的日志级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34851541/