hi,I have some questions about Log4j.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   wu_min
Posted On:   Saturday, November 23, 2002 10:43 PM

When i use Log4j,i want't let some message input in file,then some message input in console.For example ,the infomation which's level is SERVER was send control ,others were send file.But i don't know how to write the config file and how to use the config in my program.Pleas help me!If you can give me a example I am thankful!

Re: hi,I have some questions about Log4j.

Posted By:   Anonymous  
Posted On:   Monday, November 25, 2002 04:35 AM

log4j - config.xml














































use in Java

package MyProgramPackageName;

public class Client {

protected org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance( this.getClass() );

public void method() {
if (log.isDebugEnabled() {
log.debug("This is a very complex debug message");
}
log.fatal("fatal");
}


public void method2() {
protected org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance( this.getClass() + ".method2()" );
if (log.isDebugEnabled() {
log.debug("This is a very complex debug message");
}
log.fatal("fatal");
}

}

I hope this helps.
About | Sitemap | Contact