我正在为Springboot应用程序内的嵌入式服务器运行Tomcat,因此不需要Juli中的所有其他功能,例如多个类加载器等,只是妨碍了。
我只希望我的应用直接使用 java.util.logging
,而没有朱利的额外并发症。我想要一种平坦的配置,其中一切都直接流到 java.util.logging
以及我配置的方式。
我该如何抛弃朱利?
更新
我遇到的实际问题是,我无法加载自定义处理程序
...获取 classNotfound
。我最初认为这是由Juli引起的,但似乎确实与Spring Boot的System Class Manager不愿意从 Boot-Inf
加载类有关。
I'm running Tomcat as an embedded server inside of a Springboot app, so all the additional functionality in JULI such as multiple class loaders etc is not needed and just gets in the way.
I just want my app to use java.util.logging
directly without the extra complication of JULI. I want a flat configuration where everything just flows directly to java.util.logging
and the way I have configured it.
How can I ditch JULI?
UPDATE
The actual problem I'm having is that I'm unable to load a custom Handler
... getting a ClassNotFound
. I initially thought this was caused by JULI but really seems to be related to Spring Boot's System Class Manager unwillingness to load classes from BOOT-INF
.
发布评论
评论(1)
Juli只是Tomcat用于内部记录的伐木外墙(参见 javadoc )基于。这不是记录框架,也不是单独执行任何记录的框架。
默认情况下,它使用
java.util.logging
简单而简单的配置方式。您可以在独立的tomcat中找到的附加功能(每个classloader配置,同一类的多个处理程序等)由
classloaderlogmanager
。为了使用它,您需要设置:作为JVM参数(其他任何地方可能会忽略)。
Tomcat的启动脚本添加了上述Java系统属性,但您的Spring Boot应用程序几乎肯定不会。因此,您的应用程序正在使用
java.util.logging
简单而简单(除非您使用Spring> Spring-boot-starter-logging
在这种情况下java.util.logging
将其重定向到记录)。tl; dr :默认情况下,tomcat juli只是将消息转发到
java.util.logging
。没有并发症。JULI is just a logging facade used by Tomcat for its internal logging (cf. javadoc) based on Apache Commons Logging. It is not a logging framework and does not perform any logging by itself.
By default it uses
java.util.logging
plain and simple the way you configured it.The additional functionality you can find in a standalone Tomcat (per classloader configuration, multiple handlers of the same class, etc.) is provided by
ClassLoaderLogManager
. In order to use it you need to set:as JVM parameter (anywhere else it will be probably ignored).
Tomcat's startup scripts add the above mentioned Java system property, but your Spring Boot application almost certainly does not. Hence your application is using
java.util.logging
plain and simple (unless you are usingspring-boot-starter-logging
in which casejava.util.logging
is redirected to LogBack).TL;DR: by default Tomcat JULI simply forwards messages to
java.util.logging
. There are no complications.