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 Thorbjørn Ravn Andersen <no...@c.dk> on 2003/11/18 13:14:28 UTC

Using log4j to log XML-files?

I have a scenario where I would like to use log4j to save intermediate 
XML-files for later debugging.  We are using log4j 1.2.7, and it is 
cumbersome to upgrade.

I therefore need a configuration that saves exactly one log entry per 
log file, and names it with some unique name.    I tried 
DailyRollingFileAppender which - with S in the DatePattern - in theory 
should give me a uniquely named file per entry, but where the program 
logic apparently is not prepared for millisecond resolution.  
RollingFileAppender is less attractive as it renames  and deletes files 
and does not allow a timestamp in the name. 

I have a feeling I may be using a wrong approach. for this.  Any 
suggestions?

-- 
  Thorbjoern Ravn Andersen      "...plus...Tubular Bells!"



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Using log4j to log XML-files?

Posted by Thorbjørn Ravn Andersen <no...@c.dk>.
Thorbjørn Ravn Andersen wrote:

> I have a scenario where I would like to use log4j to save intermediate 
> XML-files for later debugging.  We are using log4j 1.2.7, and it is 
> cumbersome to upgrade.
>
> I therefore need a configuration that saves exactly one log entry per 
> log file, and names it with some unique name.    I tried 
> DailyRollingFileAppender which - with S in the DatePattern - in theory 
> should give me a uniquely named file per entry, but where the program 
> logic apparently is not prepared for millisecond resolution.  
> RollingFileAppender is less attractive as it renames  and deletes 
> files and does not allow a timestamp in the name.
> I have a feeling I may be using a wrong approach. for this.  Any 
> suggestions?
>
After hitting send, I realised  I forgot to describe what happens.  Both 
appenders log several entries in the same file, without rolling over.  
DailyROllingFileAppender with S in the pattern, and RolingFileAppender 
with a filesize of 1 and ImmediateFlush on.   So my problem is to get 
log4j to check for rollover _every_time, and actually do it :)

Sorry for the multiple posting.

-- 
  Thorbjoern Ravn Andersen      "...plus...Tubular Bells!"



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org