public class DefaultLogger extends AutomaticBean implements AuditListener
XMLLogger| 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,
boolean closeStreamsAfterUse)
Creates a new
DefaultLogger instance. |
DefaultLogger(java.io.OutputStream infoStream,
boolean closeInfoAfterUse,
java.io.OutputStream errorStream,
boolean closeErrorAfterUse)
Creates a new
DefaultLogger instance. |
DefaultLogger(java.io.OutputStream infoStream,
boolean closeInfoAfterUse,
java.io.OutputStream errorStream,
boolean closeErrorAfterUse,
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.
|
configure, contextualize, finishLocalSetup, 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,
boolean closeStreamsAfterUse)
DefaultLogger instance.outputStream - where to log infos and errorscloseStreamsAfterUse - if oS should be closed in auditFinished()public DefaultLogger(java.io.OutputStream infoStream,
boolean closeInfoAfterUse,
java.io.OutputStream errorStream,
boolean closeErrorAfterUse)
DefaultLogger instance.infoStream - the OutputStream for info messages.closeInfoAfterUse - auditFinished should close infoStream.errorStream - the OutputStream for error messages.closeErrorAfterUse - auditFinished should close errorStreampublic DefaultLogger(java.io.OutputStream infoStream,
boolean closeInfoAfterUse,
java.io.OutputStream errorStream,
boolean closeErrorAfterUse,
AuditEventFormatter messageFormatter)
DefaultLogger instance.infoStream - the OutputStream for info messagescloseInfoAfterUse - auditFinished should close infoStreamerrorStream - the OutputStream for error messagescloseErrorAfterUse - auditFinished should close errorStreammessageFormatter - formatter for the log message.public 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()