logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan-Olof Sivtoft" <jan-olof.sivt...@cybercomgroup.com>
Subject RE: Encryption of log
Date Thu, 15 Jun 2006 07:49:04 GMT
Hi, Curt

Thanks for the tip about RollingPolicy.

Ive been looking into (TimeBased)RollingPolicy class, but I can't figure
out how I should be able to extend this class in order to be able to
create and set the (Cipher)OutputStream from the RollingPolicy class.

In FileAppender the writer is created within the setFile method. I can't
see how to obtain the ostream (FileOutputStream) and wrapp around the
CipherOutputStream and set it back to ostream before the writer is
created from the RollingPolicy class. In RollingFileAppender the same
problem araises in method rollover but here the FileOutputStream are
created as a parameter to setWriter. 

Even if I provide a new extended RollingPolicy, extended
RolloverDescription and a new Action it seems to me as the setFile
method is always called after the Action is executed. So using the
setWriter metod from the Action will not work. Im I missing something
here?

BG / JO 

Hi Xhu1

The javax.crypto.CipherOutputStream is simply a OutputStream which take
a FileOutputStream and a javax.crypto.Cipher as parameter. There are
several different cipher to use.  

BG / JO

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: den 14 juni 2006 17:56
To: Log4J Users List
Subject: Re: Encryption of log


On Jun 14, 2006, at 2:33 AM, Jan-Olof Sivtoft wrote:

> Hi
>
> The project Im working with want to encrypt the log file. It also want

> to use RollingFileAppender. My intention was to extend 
> RollingFileAppender and change the creation of FileOutputStream to 
> ChiperOutputStream and override setFile in FileAppender to do the same

> and so on, but RollingFileAppender is final (Im using log4j
> 1.3alpha-8)
> . So I have been thinking and looking around to find out a workaround 
> without any success.
>
> So my question is: Anybody got any experience or any ideas how to 
> solve this?
>
> BG / JO
> <http://www.cybercomgroup.com/>

There are two RollingFileAppender's in log4j 1.3.x.   
org.apache.log4j.RollingFileAppender (o.a.l.RFA or log4j 1.2 RFA) and
org.apache.log4j.rolling.RollingFileAppender (o.a.l.r.RFA or log4j
1.3 RFA).  o.a.l.RFA was originally not in the log4j 1.3 development has
been added back for compatibility.  In 1.3.8, it was a proxy for
o.a.l.r.RFA which would allow log4j 1.2 configuration files to continue
to work.  But since then the log4j 1.2 RFA has been ported into log4j
1.3 so that extensions of the log4j 1.2 RFA would continue to work.

If you are wanting to extend the new o.a.l.r.RFA, you would want to  
provide a new RollingPolicy which would open encrypted files.   
o.a.l.r.RFA is marked as final since it is intended to be extended by
users providing custom RollingPolicy and TriggeringPolicy.

If you are wanting to extend the old o.a.l.RFA, you can get the source
from SVN.


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


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


Mime
View raw message