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 "Seaman, Sloan" <Sl...@ptilabs.com> on 2004/09/03 14:12:32 UTC

New logging method

I'm trying to figure out the best way to implement an audit system for my
companies apps and I was thinking about using Log4j's framework but I'm not
sure of the best way of doing it.

I need to be able to do something like:
log.audit(javax.security.auth.Subject subject, Class principalClass, String
msg);

So I was thinking I would have to create my own Logger, such as: 
AuditLogger log  = AuditLogger.getLogger(classname);

And then use the JDBC Appender to write the audit information to the
database.

Now, I figure I have to create a new new patternlayout character (such as %s
for subject) so that I can use all the different appenders easily...

But I'm curious about the best way to get the log.audit() to work with the
existing framework.

Can anyone point me in the right direction?  Should I do it this way or do
something like:
log.setSubject(); 
log.setPrincipalClass();
log.debug(msg); // have different audit levels...

Thanks!
--
Sloan