So to make sure I understand correctly:

xx_log4j.properties is a file in some directory which you have defined to
your IDE as being part of the classpath?  Correct?

There are a number of ways to get log4j to be able to read this file in
order to configure itself:
1) Simply rename the file from xx_log4j.properties to log4j.properties
2) If your IDE supports setting of environmental properties (-D options),
try setting log4j.configuration=xx_log4j.properties
3) Explicitly locate the file yourself and "feed it" to log4j.  Locating a
file relative from the classpath is acheived using the
ClassLoader.getResource() or ClassLoader.getSystemResouce() methods (they
return URL objects).  Try: String fullPath =
this.getClass().getClassLoader().getResource( "xx_log4j.properties"
).toExternalForm();

HTH



    |-----Original Message-----
    |From: Ashraf Fouad [mailto:[EMAIL PROTECTED]]
    |Sent: Tuesday, January 28, 2003 8:44 AM
    |To: Log4J Users List
    |Subject: NOONE TO ANSWER ?
    |
    |
    |
    |
    |Ashraf Fouad Ayoub
    |Senior Developer
    |Raya Software
    |
    |1 Abdel Hameed Lotfy St.,
    |Nasr City, Cairo 11371, Egypt
    |Phone:     *       (202) 670-3301/2/3/4/6/8 Ext. 295
    |Fax:       *       (202) 670-3296
    |Email:     * [EMAIL PROTECTED]
    |Web:     * http://www.rayasoftware.com/
    |
    |
    |-----Original Message-----
    |From: Ashraf Fouad 
    |Sent: Monday, January 27, 2003 11:19 AM
    |To: [EMAIL PROTECTED]
    |Subject: Can't read property file in log4j
    |
    |
    |
    |Hello all,
    |    I'm still a beginner using Log4J, I'm trying using 
    |property file for setting the confirguration for log4j in 
    |a test java file with main method, I set the classpath - 
    |in Oracle JDeveloper 9i_3 - for a location that reside 
    |with xx_log4j.properties, but the file was never read, 
    |except I write the full path of it, I opened the source of 
    |the PropertyConfigurator & I found that it reads the file 
    |using Properties class, which I think does not search the 
    |classpath for file. 
    |so any suggestion ?!?!?!?!?! 
    |I thought for an idea to use something to search the 
    |classpath for the file, then get the absolute path and 
    |pass it in the PropertyConfigurator, I tried 
    |to use ResourceBundle class but there is no method to 
    |return the absolute path.  
    |so any suggestion to determine a file in the classpath 
    |?!?!?!?!?!?!?!?
    |
    |Ashraf Fouad Ayoub
    |Senior Developer
    |Raya Software
    |
    |1 Abdel Hameed Lotfy St.,
    |Nasr City, Cairo 11371, Egypt
    |Phone:     *       (202) 670-3301/2/3/4/6/8 Ext. 295
    |Fax:       *       (202) 670-3296
    |Email:     * [EMAIL PROTECTED]
    |Web:     * http://www.rayasoftware.com/
    |
    |
    |--
    |To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to