Any Help on NDC ???
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mohammad_obari
Posted On:   Saturday, October 1, 2005 05:05 AM


Hi ,
could anybody write some helpful statments about NDC , how to use it ,and what configurations should be with it ..


thanx alot..

Re: Any Help on NDC ???

Posted By:   fresote_fresote  
Posted On:   Tuesday, October 25, 2005 06:06 AM

Use it to group all thread logs in action, etc...



private static Logger logger = Logger.getLogger(Example.class.getName());

org.apache.log4j.NDC.push("BLOCK"+new java.util.Date().getTime());

logger.debug("------------------- doing stuff");
logger.info("START");
logger.warn("trouble sneezing",new Exception("err"));
logger.error("------------------- error",new Exception("err"));
logger.fatal("------------------- fatal",new Exception("err"));
logger.info("END");
logger.debug("------------------- done");

org.apache.log4j.NDC.pop();
org.apache.log4j.NDC.remove();

About | Sitemap | Contact