logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: log4j2 will not start on tomcat 7 with a web app version 2.5
Date Thu, 24 Sep 2015 19:55:16 GMT
http://logging.apache.org/log4j/2.x/manual/webapp.html <http://logging.apache.org/log4j/2.x/manual/webapp.html>
has this sentence:

In either case, you'll need to add the log4j-web module to your deployment as detailed in
the Maven, Ivy, and Gradle Artifacts <http://logging.apache.org/log4j/2.x/maven-artifacts.html>
manual page.

Ralph



> On Sep 24, 2015, at 11:50 AM, Karl D. Kelley Jr. <karl.kelley.jr@gmail.com> wrote:
> 
> This has resolved my issues. Thank you. So what could have told me that I
> needed this jar file? I only found that I needed the api and the core jars.
> Another way to ask, I what could I learn so I do not make this mistake
> again? Thank you
> 
> On Wed, Sep 23, 2015 at 7:21 PM, Ralph Goers <ralph.goers@dslextreme.com>
> wrote:
> 
>> Do you have the log4j-web jar in your classpath?
>> 
>> Ralph
>> 
>>> On Sep 23, 2015, at 5:20 PM, Karl D. Kelley Jr. <
>> karl.kelley.jr@gmail.com> wrote:
>>> 
>>> First, I am sorry to have to post this. I have read everything I can get
>> my
>>> hands on from the internet and do not understand the issue I am having.
>>> Here it is short and sweet, when I start up tomcat7 I get this error
>>> message:
>>> 
>>> 
>>> 
>>> SEVERE: Error configuring application listener of class
>>> org.apache.logging.log4j.web.Log4jServletContextListener
>>> java.lang.ClassNotFoundException:
>>> org.apache.logging.log4j.web.Log4jServletContextListener
>>>       at
>>> 
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
>>>       at
>>> 
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
>>>       at
>>> 
>> org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
>>>       at
>>> 
>> org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
>>>       at
>>> 
>> org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
>>>       at
>>> 
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4932)
>>>       at
>>> 
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
>>>       at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>       at
>>> 
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>>>       at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>>>       at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
>>>       at
>>> 
>> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677)
>>>       at
>>> 
>> org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1912)
>>>       at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>>>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>>>       at
>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>       at
>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>       at java.lang.Thread.run(Thread.java:744)
>>> 
>>> 
>>> I understand that this means that it can not find the log4j-core and
>>> log4j-api but they are in my pom. I have even added them into the lib on
>>> tomcat7. Still no dice....
>>> 
>>> 
>>> Here is the web.xml
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
>>> http://java.sun.com/xml/ns/javaee" xmlns:web="
>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
>>> http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
>>> version="2.5">
>>> <display-name>Hynts - Service Customer Follow-Up</display-name>
>>> 
>>> <context-param>
>>>   <param-name>log4jContextName</param-name>
>>>   <param-value>Hynts</param-value>
>>> </context-param>
>>> 
>>> <context-param>
>>>       <param-name>log4jConfiguration</param-name>
>>>       <param-value>${log4j2}</param-value>
>>> </context-param>
>>> 
>>> <listener>
>>> 
>>> 
>> <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
>>>   </listener>
>>> 
>>>   <filter>
>>>       <filter-name>log4jServletFilter</filter-name>
>>> 
>>> 
>> <filter-class>org.apache.logging.log4j.web.Log4jServletFilter</filter-class>
>>>   </filter>
>>>   <filter-mapping>
>>>       <filter-name>log4jServletFilter</filter-name>
>>>       <url-pattern>/*</url-pattern>
>>>       <dispatcher>REQUEST</dispatcher>
>>>       <dispatcher>FORWARD</dispatcher>
>>>       <dispatcher>INCLUDE</dispatcher>
>>>       <dispatcher>ERROR</dispatcher>
>>>   </filter-mapping>
>>> <context-param>
>>>   <param-name>contextConfigLocation</param-name>
>>>   <param-value>classpath:/applicationContext*.xml</param-value>
>>> </context-param>
>>> <listener>
>>> 
>>> 
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>> </listener>
>>> 
>>> <servlet>
>>> <servlet-name>mvc-dispatcher</servlet-name>
>>>       <servlet-class>
>>>              org.springframework.web.servlet.DispatcherServlet
>>>       </servlet-class>
>>>       <load-on-startup>1</load-on-startup>
>>> </servlet>
>>> 
>>> <servlet-mapping>
>>>    <servlet-name>mvc-dispatcher</servlet-name>
>>>    <url-pattern>/request/*</url-pattern>
>>> </servlet-mapping>
>>> 
>>> <!--    <env-entry> -->
>>> <!--     <description>JDBC config file path</description> -->
>>> <!--     <env-entry-name>jdbc_config</env-entry-name> -->
>>> <!--     <env-entry-type>java.lang.String</env-entry-type> -->
>>> <!--     <env-entry-value>classpath:jdbc.properties</env-entry-value>
-->
>>> <!--   </env-entry> -->
>>> </web-app>
>>> 
>>> the config on tomcat:
>>> <Environment name="log4j2"
>>>           override="false"
>>>           type="java.lang.String"
>>>           value="file:///etc/hynts/log4j/log4j2.xml" />
>>> 
>>> the pom:
>>> 
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-api</artifactId>
>>> <version>2.3</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-core</artifactId>
>>> <version>2.3</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.logging.log4j</groupId>
>>> <artifactId>log4j-slf4j-impl</artifactId>
>>> <version>2.1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>net.kencochrane.raven</groupId>
>>> <artifactId>raven-log4j2</artifactId>
>>> <version>6.0.0</version>
>>> </dependency>
>>> 
>>> 
>>> Any direction at this point is appreciated, as I am at a loss... I
>>> understand tomcat cant find the jars, but they are there.... Do they go
>> in
>>> some place that other then the tomcat7 lib folder or packaged in my war?
>> Is
>>> there something on tomcat7 that needs to be set because this is a 2.5 web
>>> app?
>>> 
>>> Thank you for any assistance,
>>> Karl
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message