尝试为Tomcat 8.5的安装配置不同的日志记录设置,以便为不同的项目提供不同的日志详细信息。
我已经在工作区中为Tomcat配置文件选项设置了Eclipse 4.7,并且由于它不会创建logging.properties
文件(与大多数其他Tomcat配置文件不同),我复制了将logging.properties
从$ CATALINA_HOME / conf移至与其他文件相同的位置,并将其更改为启用我需要的其他详细信息。此更改被忽略了,大概是因为核心的tomcat配置文件仍在使用中。
我按照Tomcat ignores logging.properties when started from Eclipse的建议添加了
-Djava.util.logging.config.file="F:\eclipse workspaces\myprojectname\Servers\Tomcat v8.5 Server at localhost-config\logging.properties"
到服务器启动配置对话框中的参数列表。
现在启动服务器时,出现以下错误:
Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager$2.run(LogManager.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:1578)
at java.util.logging.LogManager.access$1500(LogManager.java:145)
at java.util.logging.LogManager$RootLogger.addHandler(LogManager.java:1655)
at java.util.logging.LogManager$5.run(LogManager.java:980)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager$2.run(LogManager.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Can't load log handler "2localhost.org.apache.juli.AsyncFileHandler"
java.lang.ClassNotFoundException: 2localhost.org.apache.juli.AsyncFileHandler
java.lang.ClassNotFoundException: 2localhost.org.apache.juli.AsyncFileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:1578)
at java.util.logging.LogManager.access$1500(LogManager.java:145)
at java.util.logging.LogManager$RootLogger.addHandler(LogManager.java:1655)
at java.util.logging.LogManager$5.run(LogManager.java:980)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager$2.run(LogManager.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Can't load log handler "3manager.org.apache.juli.AsyncFileHandler"
java.lang.ClassNotFoundException: 3manager.org.apache.juli.AsyncFileHandler
java.lang.ClassNotFoundException: 3manager.org.apache.juli.AsyncFileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:1578)
at java.util.logging.LogManager.access$1500(LogManager.java:145)
at java.util.logging.LogManager$RootLogger.addHandler(LogManager.java:1655)
at java.util.logging.LogManager$5.run(LogManager.java:980)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager$2.run(LogManager.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Can't load log handler "4host-manager.org.apache.juli.AsyncFileHandler"
java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.AsyncFileHandler
java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.AsyncFileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$5.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:1578)
at java.util.logging.LogManager.access$1500(LogManager.java:145)
at java.util.logging.LogManager$RootLogger.addHandler(LogManager.java:1655)
at java.util.logging.LogManager$5.run(LogManager.java:980)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager$2.run(LogManager.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:68)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:188)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
除此以外,服务器可以正常启动,但是似乎应用的某些日志记录选项被忽略了,例如使用的是默认日志格式,而不是控制台输出中通常出现的更友好的格式。似乎该配置被解释为标准的java.util.logging配置,而不是Tomcat通常使用的增强型JULI变体。
当通过Eclipse启动时,如何说服Tomcat / JULI理解此配置文件?