通过旧问题修复后,我已经修复了此链接中指定的内容
How to configure log4j with a properties file但现在我面临一个新问题,即
我得到以下错误消息:
log4j:ERROR Could not instantiate class [org.apache.log4j.PatterLayout].
java.lang.ClassNotFoundException: org.apache.log4j.PatterLayout
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:169)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:317)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:120)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:641)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:336)
at com.akak.book.shop.listener.JlcindiaContextListener.contextInitialized(JlcindiaContextListener.java:33)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
任何人都可以帮我解决这个问题.....
答案 0 :(得分:3)
您在log4j.properties中拼写错误PatternLayout
。你错过了“N”!