问题:Tomcat启动成功,项目无法访问
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
log4j:ERROR Could not find value for key log4j.appender.DEBUG
log4j:ERROR Could not instantiate appender named "DEBUG".
Nov 14, 2019 10:30:35 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Nov 14, 2019 10:30:35 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/项目名] startup failed due to previous errors
Nov 14, 2019 10:30:35 AM org.apache.catalina.startup.HostConfig deployWAR
不显示更详细的错误,可以先配置一下日志,这类错误主要是缺少日志提示配置,并不是项目没有错误。
解决方法:
创建 /src/main/resources/logging.properties
logging.properties
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
这样,我们再启动tomcat时,log文件会显示更详细的错误