让Tomcat启动时,打印出更多信息

前言

在启动Tomcat时,有时候因为一些错误启动不起来,但log信息又非常少,如何能让Tomcat打印出更多的信息呢?

正文

方法就是:

修改{catalina_home}/conf/logging.properties 文件。

大家在启动时可能常会看到下面的信息:

26-Dec-2016 21:45:31.293 信息 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.

  上面的信息是说“有一些Jar里没有找到TLD文件”,其实这个信息没有什么大问题。但如果想看一下“到底在哪些Jar里没有找到TLD文件”的话,应该怎么做呢?
  看上面的信息中,意思是说org.apache.jasper.servlet.TldScanner 类的scanJars方法,在扫描时没有找到TLD文件。那么我们就在logging.properties 文件中加入下面的配置:

org.apache.jasper.servlet.TldScanner.level = FINE

说明:
1,org.apache.jasper.servlet.TldScanner 是刚才说的类。
2,level=FINE 是配置这个类的信息打印级别,我们这里设置成Fine,也可以设置成更低一些,例如:Debug。

设置完后,我们再启动一下Tomcat,就会看到下面的信息。这样详细的信息(哪个Jar有TLD文件,哪个Jar没有)都列出来了。

26-Dec-2016 23:07:59.245 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/view/].
26-Dec-2016 23:07:59.245 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
26-Dec-2016 23:07:59.248 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner TldScannerCallback.scanNoTLDfileswerefoundin[file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFrameworkChapter3/target/chapter31.0.0/WEBINF/lib/jacksoncore2.5.1.jar].ConsideraddingtheJARtothetomcat.util.scan.StandardJarScanFilter.jarsToSkippropertyinCATALINABASE/conf/catalina.propertiesfile.26Dec201623:07:59.248[RMITCPConnection(4)127.0.0.1]org.apache.jasper.servlet.TldScanner TldScannerCallback.scan No TLD files were found in [file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFramework-Chapter3/target/chapter3-1.0.0/WEB-INF/lib/commons-dbutils-1.6.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Dec-2016 23:07:59.253 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner TldScannerCallback.scanTLDfileswerefoundinJAR[file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFrameworkChapter3/target/chapter31.0.0/WEBINF/lib/smartpluginsecurity1.0.0.jar].26Dec201623:07:59.264[RMITCPConnection(4)127.0.0.1]org.apache.jasper.servlet.TldScanner TldScannerCallback.scan TLD files were found in JAR [file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFramework-Chapter3/target/chapter3-1.0.0/WEB-INF/lib/shiro-web-1.2.3.jar].
26-Dec-2016 23:07:59.265 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner TldScannerCallback.scanNoTLDfileswerefoundin[file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFrameworkChapter3/target/chapter31.0.0/WEBINF/lib/shirocore1.2.3.jar].ConsideraddingtheJARtothetomcat.util.scan.StandardJarScanFilter.jarsToSkippropertyinCATALINABASE/conf/catalina.propertiesfile.26Dec201623:07:59.266[RMITCPConnection(4)127.0.0.1]org.apache.jasper.servlet.TldScanner TldScannerCallback.scan No TLD files were found in [file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFramework-Chapter3/target/chapter3-1.0.0/WEB-INF/lib/jackson-annotations-2.5.0.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Dec-2016 23:07:59.267 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner TldScannerCallback.scanNoTLDfileswerefoundin[file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFrameworkChapter3/target/chapter31.0.0/WEBINF/lib/smartframework1.0.0.jar].ConsideraddingtheJARtothetomcat.util.scan.StandardJarScanFilter.jarsToSkippropertyinCATALINABASE/conf/catalina.propertiesfile.26Dec201623:07:59.320[RMITCPConnection(4)127.0.0.1]org.apache.jasper.servlet.TldScanner TldScannerCallback.scan TLD files were found in JAR [file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFramework-Chapter3/target/chapter3-1.0.0/WEB-INF/lib/jstl-1.2.jar].
26-Dec-2016 23:07:59.321 详细 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner TldScannerCallback.scanNoTLDfileswerefoundin[file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFrameworkChapter3/target/chapter31.0.0/WEBINF/lib/mysqlconnectorjava5.1.39.jar].ConsideraddingtheJARtothetomcat.util.scan.StandardJarScanFilter.jarsToSkippropertyinCATALINABASE/conf/catalina.propertiesfile.26Dec201623:07:59.322[RMITCPConnection(4)127.0.0.1]org.apache.jasper.servlet.TldScanner TldScannerCallback.scan No TLD files were found in [file:/Users/shijiapeng/IdeaProjects/Smart4jFramework/Smart4jFramework-Chapter3/target/chapter3-1.0.0/WEB-INF/lib/jackson-databind-2.5.2.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
26-Dec-2016 23:07:59.323 信息 [RMI TCP Connection(4)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值