如何禁用 Javalin 日志记录
How to disable Javalin logging
我想在 Javalin 下关闭此日志记录:
[main] INFO org.eclipse.jetty.util.log - Logging initialized @850ms to org.eclipse.jetty.util.log.Slf4jLog
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO io.javalin.Javalin - Listening on http://localhost:8003/
[main] INFO io.javalin.Javalin - Javalin started in 334ms \o/
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO io.javalin.Javalin - Listening on http://localhost:6667/
[main] INFO io.javalin.Javalin - Javalin started in 7ms \o/
[main] INFO io.javalin.Javalin - Stopping Javalin ...
[main] INFO io.javalin.Javalin - Javalin has stopped
[main] INFO io.javalin.Javalin - Stopping Javalin ...
[main] INFO io.javalin.Javalin - Javalin has stopped
...但是 Javalin 似乎没有办法关闭这些日志。有办法吗?谢谢
Javalin 使用 SLF4J for logging (you can even see the class name Slf4jLog
in the first message). This is an abstracton which can work with many different actual implementations, so the first step is to find which one your project uses. List the dependencies (Gradle, Maven) and look for slf4j-<something>
(except slf4j-api
) or logback-classic
. Then look at https://www.slf4j.org/manual.html#swapping 作为您找到的那个,并了解如何将其配置为比 INFO
更高的级别。
例如如果你关注
Javalin does not have a logger included, which means that you have to add your own logger. If you don’t know/care a lot about Java loggers, the easiest way to fix this is to add the following dependency to your project:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
</dependency>
从 Javalin 文档中,参见 How to configure slf4j-simple。
我想在 Javalin 下关闭此日志记录:
[main] INFO org.eclipse.jetty.util.log - Logging initialized @850ms to org.eclipse.jetty.util.log.Slf4jLog
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO io.javalin.Javalin - Listening on http://localhost:8003/
[main] INFO io.javalin.Javalin - Javalin started in 334ms \o/
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO io.javalin.Javalin - Listening on http://localhost:6667/
[main] INFO io.javalin.Javalin - Javalin started in 7ms \o/
[main] INFO io.javalin.Javalin - Stopping Javalin ...
[main] INFO io.javalin.Javalin - Javalin has stopped
[main] INFO io.javalin.Javalin - Stopping Javalin ...
[main] INFO io.javalin.Javalin - Javalin has stopped
...但是 Javalin 似乎没有办法关闭这些日志。有办法吗?谢谢
Javalin 使用 SLF4J for logging (you can even see the class name Slf4jLog
in the first message). This is an abstracton which can work with many different actual implementations, so the first step is to find which one your project uses. List the dependencies (Gradle, Maven) and look for slf4j-<something>
(except slf4j-api
) or logback-classic
. Then look at https://www.slf4j.org/manual.html#swapping 作为您找到的那个,并了解如何将其配置为比 INFO
更高的级别。
例如如果你关注
Javalin does not have a logger included, which means that you have to add your own logger. If you don’t know/care a lot about Java loggers, the easiest way to fix this is to add the following dependency to your project:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.26</version> </dependency>
从 Javalin 文档中,参见 How to configure slf4j-simple。