You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Aggarwal, Rajat" <ra...@razorsight.com> on 2008/07/01 14:26:48 UTC

Using HTMLLayout with DailyRollingFileAppender

HI All,

 

I have a requirement in one of my prjects that the log files be
generated in HTML format and that they should automatically be rolled
over everyday. For thi purpose, I am trying to use HTMLLayout with
DailyRollingFileAppender. However, the file is not rolled over. Instead,
the log information is only appended in the old file itself. Is there
any other way in which I can achive the same??

 

The code I have written for the same is as follows:  

 

 

Final Logger log = Logger..getLogger(xyz.class);

String strDatePattern = "'.'yyyyMMdd";       

HTMLLayout layout = new HTMLLayout();

String filename = "test.html";

 

DailyRollingFileAppender appender = new DailyRollingFileAppender
(layout, filename,  strDatePattern);

appender.activateOptions();

log.info("My Message Goes Here");

 

 

 

An early help would be appreciated.

 

Thanks and Regards

 

Rajat Aggarwal