Attach one appender to the audit logger and a different category to
the other logger (com?)

On 3/17/06, Rakesh Patel <[EMAIL PROTECTED]> wrote:
> so i have another logger but how do i control loggers output to a
> specific appender?
>
> cheers
>
> Rakesh
>
> James Stauffer wrote:
>
> >Do it like the following.  Then it will be easy to send the audit logs
> >to another location.
> >
> >final static Logger _logger = Logger.getLogger(ReferenceDataDaoImpl.class);
> >final static Logger _auditor =
> >Logger.getLogger("audit."ReferenceDataDaoImpl.class.getName());
> >
> >
> >On 3/17/06, Rakesh Patel <[EMAIL PROTECTED]> wrote:
> >
> >
> >>Hi,
> >>
> >>i have a requirement to audit events to a database table. I thought of
> >>using the log4j JdbcAppender to do this but the issue i have is there's
> >>auditing and there's debugging.
> >>
> >>For example,
> >>
> >>logger.debug("Value of variable is now:{}",aVariable); // this is not
> >>needed for auditing
> >>logger.debug("Successful logon for username:{}",userName); // this
> >>should end up in the audit table
> >>
> >>My current configuration of log4j is to declare a class-specific logger
> >>in each class that needs logging:
> >>
> >>final static Logger _logger = Logger.getLogger(ReferenceDataDaoImpl.class);
> >>
> >>I could use this logger and utilise thresholds and have audit events
> >>triggered by calling logger.error() but that does not seem a very clean
> >>approach.
> >>
> >>Another idea is to declare an additional logger to be used for auditing:
> >>
> >>final static Logger _logger = Logger.getLogger(ReferenceDataDaoImpl.class);
> >>final static Logger _auditor = Logger.getLogger(ReferenceDataDaoImpl.class);
> >>
> >>and have that logger use JdbcAppender. Or maybe one global logger for
> >>auditing?
> >>
> >>What do you guys think?
> >>
> >>Cheers
> >>
> >>Rakesh
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >
> >
> >--
> >James Stauffer
> >Are you good? Take the test at http://www.livingwaters.com/good/
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to