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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
winmail.dat
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]