public class DefaultLogger extends AutomaticBean implements AuditListener
XMLLogger| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultLogger.LocalizedMessage
Represents a message that can be localised.
|
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ADD_EXCEPTION_MESSAGE
A key pointing to the add exception
message in the "messages.properties" file.
|
static java.lang.String |
AUDIT_FINISHED_MESSAGE
A key pointing to the finished audit
message in the "messages.properties" file.
|
static java.lang.String |
AUDIT_STARTED_MESSAGE
A key pointing to the started audit
message in the "messages.properties" file.
|
private boolean |
closeError
Close error stream after use.
|
private boolean |
closeInfo
Close info stream after use.
|
private java.io.PrintWriter |
errorWriter
Where to write error messages.
|
private AuditEventFormatter |
formatter
Formatter for the log message.
|
private java.io.PrintWriter |
infoWriter
Where to write info messages.
|
| Constructor and Description |
|---|
DefaultLogger(java.io.OutputStream outputStream,
AutomaticBean.OutputStreamOptions outputStreamOptions)
Creates a new
DefaultLogger instance. |
DefaultLogger(java.io.OutputStream infoStream,
AutomaticBean.OutputStreamOptions infoStreamOptions,
java.io.OutputStream errorStream,
AutomaticBean.OutputStreamOptions errorStreamOptions)
Creates a new
DefaultLogger instance. |
DefaultLogger(java.io.OutputStream infoStream,
AutomaticBean.OutputStreamOptions infoStreamOptions,
java.io.OutputStream errorStream,
AutomaticBean.OutputStreamOptions errorStreamOptions,
AuditEventFormatter messageFormatter)
Creates a new
DefaultLogger instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addError(AuditEvent event)
Print an Emacs compliant line on the error stream.
|
void |
addException(AuditEvent event,
java.lang.Throwable throwable)
Notify that an exception happened while performing audit.
|
void |
auditFinished(AuditEvent event)
Notify that the audit is finished.
|
void |
auditStarted(AuditEvent event)
Notify that the audit is about to start.
|
private void |
closeStreams()
Flushes the output streams and closes them if needed.
|
void |
fileFinished(AuditEvent event)
Notify that audit is finished on a specific file.
|
void |
fileStarted(AuditEvent event)
Notify that audit is about to start on a specific file.
|
protected void |
finishLocalSetup()
Provides a hook to finish the part of this component's setup that
was not handled by the bean introspection.
|
configure, contextualize, getConfiguration, setupChildpublic static final java.lang.String ADD_EXCEPTION_MESSAGE
public static final java.lang.String AUDIT_STARTED_MESSAGE
public static final java.lang.String AUDIT_FINISHED_MESSAGE
private final java.io.PrintWriter infoWriter
private final boolean closeInfo
private final java.io.PrintWriter errorWriter
private final boolean closeError
private final AuditEventFormatter formatter
public DefaultLogger(java.io.OutputStream outputStream, AutomaticBean.OutputStreamOptions outputStreamOptions)
DefaultLogger instance.outputStream - where to log audit eventsoutputStreamOptions - if CLOSE that should be closed in auditFinished()public DefaultLogger(java.io.OutputStream infoStream, AutomaticBean.OutputStreamOptions infoStreamOptions, java.io.OutputStream errorStream, AutomaticBean.OutputStreamOptions errorStreamOptions)
DefaultLogger instance.infoStream - the OutputStream for info messages.infoStreamOptions - if CLOSE info should be closed in auditFinished()errorStream - the OutputStream for error messages.errorStreamOptions - if CLOSE error should be closed in auditFinished()public DefaultLogger(java.io.OutputStream infoStream, AutomaticBean.OutputStreamOptions infoStreamOptions, java.io.OutputStream errorStream, AutomaticBean.OutputStreamOptions errorStreamOptions, AuditEventFormatter messageFormatter)
DefaultLogger instance.infoStream - the OutputStream for info messagesinfoStreamOptions - if CLOSE info should be closed in auditFinished()errorStream - the OutputStream for error messageserrorStreamOptions - if CLOSE error should be closed in auditFinished()messageFormatter - formatter for the log message.java.lang.IllegalArgumentException - if stream options are nullprotected void finishLocalSetup()
AutomaticBeanThe default implementation does nothing.
finishLocalSetup in class AutomaticBeanpublic void addError(AuditEvent event)
addError in interface AuditListenerevent - the event detailsAuditListenerpublic void addException(AuditEvent event, java.lang.Throwable throwable)
AuditListeneraddException in interface AuditListenerevent - the event detailsthrowable - details of the exceptionpublic void auditStarted(AuditEvent event)
AuditListenerauditStarted in interface AuditListenerevent - the event detailspublic void auditFinished(AuditEvent event)
AuditListenerauditFinished in interface AuditListenerevent - the event detailspublic void fileStarted(AuditEvent event)
AuditListenerfileStarted in interface AuditListenerevent - the event detailspublic void fileFinished(AuditEvent event)
AuditListenerfileFinished in interface AuditListenerevent - the event detailsprivate void closeStreams()
Copyright © 2001-2022. All Rights Reserved.