logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gunter Sammet" <Gun...@sammet.net>
Subject RE: example.xml not found in jar file
Date Wed, 12 Sep 2001 14:05:24 GMT
I got it now working that if I include the jar and the directory in the
classpath, that it finds the XML files outside of the jar. I couldn't get
them recognized inside the jar file. This is my init for log4j:

      // Use a PropertyConfigurator to initialize from a property file.
      String parentDir = "..";
      String sep = File.separator;
      String resource = "example.xml"; //me
      String resourceOcc = "exampleOcc.xml"; //occlaptop
                          System.out.println("String resource: " +
resource); //TESTLINE
      if (who.equals("me")) {
          resource = parentDir + sep + resource;
      } else {
        resource = parentDir + sep + resourceOcc;
      }
    	  URL configFileResource =
OccGuiApplication.class.getResource(resource);
                          System.out.println("URL: " + configFileResource);
//TESTLINE
if(configFileResource != null) {
                          System.out.println("URL.getFile " +
configFileResource.getFile()); //TESTLINE
	  	  DOMConfigurator.configure(configFileResource.getFile());


      //This is a test to redirect System.err to log4j:
      // make sure everything sent to System.err is logged
      System.setErr(new PrintStream(new
LoggingOutputStream(Category.getRoot(), Priority.WARN), true));




-----Original Message-----
From: log4j-user-return-2997-Gunter=sammet.net@jakarta.apache.org
[mailto:log4j-user-return-2997-Gunter=sammet.net@jakarta.apache.org]On
Behalf Of Jon Skeet
Sent: Wednesday, September 12, 2001 1:36 AM
To: LOG4J Users Mailing List
Subject: RE: example.xml not found in jar file


> I have my log4j init file (example.xml) in a jar file 
> (current directory of
> jar file). The jar is in the classpath. When I start the 
> application, it
> doesn't find the file. How can I pinpoint the reason?

How are you trying to tell log4j to initialise?

Jon

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message