0 Replies Latest reply on Jan 11, 2006 12:24 PM by swarne111

    log4j with JBoss

    swarne111

      I am having a strange problem. I have configured JBoss 4.0.2:
      [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] to use jboss-log4j.xml; have changed jboss-services.xml to reflect this. I have created a jboss-web.xml and have a log4j.properties in my WEB-INF/classes.

      When I try to log to log4j from my application I get the following:

      <====================start================>
      10:58:40,347 INFO [STDOUT] log4j:ERROR Could not read configuration file from U
      RL [file:/C:/Program%20Files/jboss-4.0.2/server/default/tmp/deploy/tmp37892ROOT-
      exp.war/WEB-INF/classes/log4j.properties].
      10:58:40,347 INFO [STDOUT] java.io.FileNotFoundException: C:\Program%20Files\jb
      oss-4.0.2\server\default\tmp\deploy\tmp37892ROOT-exp.war\WEB-INF\classes\log4j.p
      roperties
      10:58:40,347 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection
      .connect(FileURLConnection.java:80)
      10:58:40,347 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection
      .getInputStream(FileURLConnection.java:89)
      10:58:40,347 INFO [STDOUT] at java.net.URL.openStream(URL.java:1007)
      10:58:40,347 INFO [STDOUT] at org.apache.log4j.PropertyConfigurator.doConfi
      gure(PropertyConfigurator.java:424)
      10:58:40,347 INFO [STDOUT] at org.apache.log4j.helpers.OptionConverter.sele
      ctAndConfigure(OptionConverter.java:460)
      10:58:40,357 INFO [STDOUT] at org.apache.log4j.LogManager.(LogManag
      er.java:113)
      10:58:40,357 INFO [STDOUT] at org.apache.log4j.Logger.getLogger(Logger.java
      :85)
      10:58:40,357 INFO [STDOUT] at showme.servlet.Articles.(Articles.jav
      a:44)
      10:58:40,357 INFO [STDOUT] at sun.reflect.NativeConstructorAccessorImpl.new
      Instance0(Native Method)
      10:58:40,357 INFO [STDOUT] at sun.reflect.NativeConstructorAccessorImpl.new
      Instance(NativeConstructorAccessorImpl.java:39)
      10:58:40,357 INFO [STDOUT] at sun.reflect.DelegatingConstructorAccessorImpl
      .newInstance(DelegatingConstructorAccessorImpl.java:27)
      10:58:40,357 INFO [STDOUT] at java.lang.reflect.Constructor.newInstance(Con
      structor.java:494)
      10:58:40,357 INFO [STDOUT] at java.lang.Class.newInstance0(Class.java:350)
      10:58:40,357 INFO [STDOUT] at java.lang.Class.newInstance(Class.java:303)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardWrapper.load
      Servlet(StandardWrapper.java:1048)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardWrapper.allo
      cate(StandardWrapper.java:750)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve
      .invoke(StandardWrapperValve.java:130)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve
      .invoke(StandardContextValve.java:178)
      10:58:40,357 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipal
      Valve.invoke(CustomPrincipalValve.java:39)
      10:58:40,357 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssocia
      tionValve.invoke(SecurityAssociationValve.java:153)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.authenticator.Authenticat
      orBase.invoke(AuthenticatorBase.java:407)
      10:58:40,357 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValv
      e.invoke(JaccContextValve.java:59)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.in
      voke(StandardHostValve.java:126)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.i
      nvoke(ErrorReportValve.java:105)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.
      invoke(StandardEngineValve.java:107)
      10:58:40,357 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.s
      ervice(CoyoteAdapter.java:148)
      10:58:40,357 INFO [STDOUT] at org.apache.jk.server.JkCoyoteHandler.invoke(J
      kCoyoteHandler.java:307)
      10:58:40,357 INFO [STDOUT] at org.apache.jk.common.HandlerRequest.invoke(Ha
      ndlerRequest.java:385)
      10:58:40,367 INFO [STDOUT] at org.apache.jk.common.ChannelSocket.invoke(Cha
      nnelSocket.java:748)
      10:58:40,367 INFO [STDOUT] at org.apache.jk.common.ChannelSocket.processCon
      nection(ChannelSocket.java:678)
      10:58:40,367 INFO [STDOUT] at org.apache.jk.common.SocketConnection.runIt(C
      hannelSocket.java:871)
      10:58:40,367 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$Con
      trolRunnable.run(ThreadPool.java:684)
      10:58:40,367 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      10:58:40,367 INFO [STDOUT] log4j:ERROR Ignoring configuration file [file:/C:/Pr
      ogram%20Files/jboss-4.0.2/server/default/tmp/deploy/tmp37892ROOT-exp.war/WEB-INF
      /classes/log4j.properties].
      10:58:40,427 INFO [STDOUT] log4j:WARN No appenders could be found for logger (R
      OOT).
      10:58:40,427 INFO [STDOUT] log4j:WARN Please initialize the log4j system

      <========================> End ===========>

      The thing is that the file log4j.properties exists in the right place. I can see it yet a FileNotFoundException is being thrown.

      The same war file deploys properly in 4.0.3SP1. Can anyone shed any light on this?

      Thanks.