Wanted to use Log4j without configuration file.
So here is the clean code.
//Java
FileAppender fa = new FileAppender(new SimpleLayout(),filename,true);
fa.activateOptions();
Logger logger = Logger.getLogger(filename);
logger.addAppender(fa);
logger.info(data);
logger.removeAllAppenders();
2 comments:
Just keep posting good stuff.
Hi,
I am quite impressed with this site and the contributions. I am happy that I am part of this site and I wish to contribute regularly.
Thanks
Post a Comment