3 Replies Latest reply on Apr 23, 2005 12:49 PM by starksm64

    Classic log4j /log/boot.log java.io.FileNotFoundException tr


      I must have read 100 people like me, who cant work out how to override log4j's configuration in my Test Clients execution context.

      $JBOSS_HOME/log/boot.log exists and JBoss logs its output there as well as STDOUT, this is what I want. But my Client applications I develop under eclipse and lomboz have this annoying stack trace (from the client side attempting to use log4j too).

      I can not even find where the initial configuraton that sets it to boot.log comes from, I would guess its a property file inside the client side jars ($JBOSS_HOME/client/lib) so not easy to find get at and change.

      I suspect the reason why its an absolute path is because some property $(jboss.something.dir) variable is not defined or setup from the client site.

      Any new ideas, references or pointers would be appreciated.


      The strack track:

      log4j:ERROR Failed to create directory structure: /log
      log4j:ERROR setFile(null,false) call failed.
      java.io.FileNotFoundException: /log/boot.log (No such file or directory)
      at java.io.FileOutputStream.open(Native Method)
      at java.io.FileOutputStream.(FileOutputStream.java:179)
      at java.io.FileOutputStream.(FileOutputStream.java:102)
      at org.apache.log4j.FileAppender.setFile(FileAppender.java:272)
      at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151)
      at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247)
      at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:123)

        • 1. Re: Classic log4j /log/boot.log java.io.FileNotFoundExceptio


          [starksm@banshee9100 bin]$ jar -tf run.jar | grep log4j
          [starksm@banshee9100 tmp]$ cat log4j.properties
          ### ====================================================================== ###
          ## ##
          ## JBoss Bootstrap Log4j Configuration ##
          ## ##
          ### ====================================================================== ###
          ### $Id: log4j.properties,v 1.3 2002/07/12 21:52:36 user57 Exp $ ###
          log4j.rootCategory=DEBUG, FILE, CONSOLE
          ### A bootstrap file appender
          log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
          log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n

          • 2. Re: Classic log4j /log/boot.log java.io.FileNotFoundExceptio


            "scott.stark@jboss.org" wrote:

            Thanks for the reply. I really dont understand how .properties files work, but here is what I did to correct the problem.

            I obviously dont want to edit run.jar as that will affect everything (not just my TestClient) and its only my test client with a problem.

            I extracted the log4j.properties edited to how I wanted, changing just the following line:


            Then created a JAR from it called $JBOSS_HOME/bin/run-client-test.jar

            Then I have created an execution (Run/Debug) context within Eclipse (Run->Run) that allows me to add as the first library my newly created JAR (just above run.jar). So that its in the classpath when my TestClient gets run.

            Now I get a useful log file and no error :).

            • 3. Re: Classic log4j /log/boot.log java.io.FileNotFoundExceptio

              Use -Dlog4j.configuration=/path_to_log4j_properties in the JAVA_OPTS to point to an external bootstrap configuration. See the log4j site for the details.