The only thing you're doing wrong is you need to call a valid version of
the configure() method, like:

private static Category log;

......

BufferedInputStream bis = new BufferedInputStream(
     new FileInputStream(propsPath + File.separator + "log4j.properties"));

Properties props = new Properties();
props.load(bis);

try {
     PropertyConfigurator.configure(props);
} catch (IOException ioe) {
     ioe.printStackTrace();
}

log = Category.getInstance(className);

log.debug("it works");



Andy

****************************
Andrew Goodnough
Dana Commercial Credit
Programmer




                                                                                       
                     
                    "Huber, Christian"                                                 
                     
                    <[EMAIL PROTECTED]        To:     
"'[EMAIL PROTECTED]'"               
                    emens.com>                      <[EMAIL PROTECTED]>    
                     
                                                    cc:                                
                     
                    12/20/2001 07:56 PM             Subject:     Can not create file! 
Help please!          
                    Please respond to "Log4J                                           
                     
                    Users List"                                                        
                     
                                                                                       
                     
                                                                                       
                     



Hi,
I am a newbie in log4j as well as programming Java. I hope, that anybody
can
tell me, what I am doing wrong. I try to create a rolling file appender,
but
my file won't be created :-( Here is my property file:

log4j.category=DEBUG, fileApp
log4j.appender.fileApp=org.apache.log4j.RollingFileAppender
log4j.appender.fileApp.File=logs.log
log4j.appender.fileApp.MaxFileSize = 10MB
# Keep one backup file
log4j.appender.fileApp.MaxBackupIndex =2
log4j.appender.fileApp.layout=org.apache.log4j.PatternLayout
log4j.appender.fileApp.layout.ConversionPattern=%-5p %d [%t]: %m %n

And here is the code:
      FileInputStream fstream = new
FileInputStream("c:\\temp\\proper.prop");
      Properties append = new Properties();
      append.load(fstream);
      String myApp = append.getProperty("Appender");
      System.out.println(myApp);
      PropertyConfigurator.configure();

I would really appreciate it, if somebody could help me asap.

Thanks in advance! Chris

Christian Huber
Siemens Procurement and Logistics Services, LLC
c2p Operations - click2procureSM

4900 Old Ironsides Drive, Bldg.1
Mailstop 100
Santa Clara, CA 95054, USA
Tel.:  (408) 764-9223          Fax: (408) 764-9210

E-mail: [EMAIL PROTECTED]
Siemens e-Procurement Solution/Buy-Side Marketplace:
<http://www.click2procure.com>
Be part of Siemens Suppliers? Suppliers Registration:
<http://click4suppliers.siemens.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]>

Reply via email to