设置:
eclipse juno r,tomcat 7.0.8,tomcat通过eclipse插件运行。
来自eclipse的tomcat启动配置具有vm参数
-djava.util.logging.config.file=“c:\ ws\serverlogs\tomcat7\conf\logging.properties”
(参考文献:
Where can I view Tomcat log files in Eclipse?
)
正在获取跟踪错误。
Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.util.logging.LogManager$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
at java.util.logging.LogManager.addLogger(Unknown Source)
at java.util.logging.LogManager$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(Unknown Source)
at java.util.logging.Logger.getLogger(Unknown Source)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:71)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:242)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:293)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:57)
Can't load log handler "1catalina.org.apache.juli.FileHandler"
“1catalina.org.apache.juli.filehandler”、“2localhost.org.apache.juli.filehandler”和其他文件也有类似的错误。
我知道这些类来自tomcat-juli.jar at/bin。
我将这个jar添加到服务器类路径(eclipse->servers->open->open lauch configuration->classpath->user entries)中,但得到了相同的错误。
logging.properties的内容是:
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = C:\WS\Serverlogs\tomcat7/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler
我们非常感谢您的任何意见/指导。
找到这些
How to configure Tomcat JULI logging to roll log files?
Local Tomcat Environment Not Starting
,但我的问题似乎不同。
编辑1
在服务器的vm参数中添加“-djava.util.logging.manager=org.apache.juli.classloaderLogManager”,并在logging.properties中将“\”改为“/”就成功了。
感谢Robin为Tomcat日志FAQ提供的指针
谢谢您,
VJ