public class XMLLogger extends AutomaticBean implements AuditListener
| Modifier and Type | Class and Description |
|---|---|
private static class |
XMLLogger.FileMessages
The registered file messages.
|
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
private static int |
BASE_10
Decimal radix.
|
private static int |
BASE_16
Hex radix.
|
private boolean |
closeStream
Close output stream in auditFinished.
|
private static java.lang.String[] |
ENTITIES
Some known entities to detect.
|
private java.util.Map<java.lang.String,XMLLogger.FileMessages> |
fileMessages
Holds all messages for the given file.
|
private java.io.PrintWriter |
writer
Helper writer that allows easy encoding and printing.
|
private java.lang.Object |
writerLock
The writer lock object.
|
| Constructor and Description |
|---|
XMLLogger(java.io.OutputStream outputStream,
AutomaticBean.OutputStreamOptions outputStreamOptions)
Creates a new
XMLLogger instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addError(AuditEvent event)
Notify that an audit error was discovered on a specific file.
|
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.
|
static java.lang.String |
encode(java.lang.String value)
Escape <, > & ' and " as their entities.
|
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.
|
static boolean |
isReference(java.lang.String ent)
Finds whether the given argument is character or entity reference.
|
private void |
writeException(java.lang.Throwable throwable)
Writes the exception event to the print writer.
|
private void |
writeFileClosingTag()
Prints the "file" closing tag.
|
private void |
writeFileError(AuditEvent event)
Outputs the given event to the writer.
|
private void |
writeFileMessages(java.lang.String fileName,
XMLLogger.FileMessages messages)
Prints the file section with all file errors and exceptions.
|
private void |
writeFileOpeningTag(java.lang.String fileName)
Prints the "file" opening tag with the given filename.
|
configure, contextualize, getConfiguration, setupChildprivate static final int BASE_10
private static final int BASE_16
private static final java.lang.String[] ENTITIES
private final boolean closeStream
private final java.lang.Object writerLock
private final java.util.Map<java.lang.String,XMLLogger.FileMessages> fileMessages
private final java.io.PrintWriter writer
public XMLLogger(java.io.OutputStream outputStream, AutomaticBean.OutputStreamOptions outputStreamOptions)
XMLLogger instance.
Sets the output to a defined stream.outputStream - the stream to write logs to.outputStreamOptions - if CLOSE stream should be closed in auditFinished()java.lang.IllegalArgumentException - if outputStreamOptions is null.protected void finishLocalSetup()
AutomaticBeanThe default implementation does nothing.
finishLocalSetup in class AutomaticBeanpublic 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 writeFileMessages(java.lang.String fileName, XMLLogger.FileMessages messages)
fileName - The file name, as should be printed in the opening file tag.messages - The file messages.private void writeFileOpeningTag(java.lang.String fileName)
fileName - The filename to output.private void writeFileClosingTag()
public void addError(AuditEvent event)
AuditListeneraddError in interface AuditListenerevent - the event detailsprivate void writeFileError(AuditEvent event)
event - An event to print.public void addException(AuditEvent event, java.lang.Throwable throwable)
AuditListeneraddException in interface AuditListenerevent - the event detailsthrowable - details of the exceptionprivate void writeException(java.lang.Throwable throwable)
throwable - Thepublic static java.lang.String encode(java.lang.String value)
value - the value to escape.public static boolean isReference(java.lang.String ent)
ent - the possible entity to look for.Copyright © 2001-2022. All Rights Reserved.