Package org.jpos.util
Class MappingLogEventWriter
- java.lang.Object
-
- org.jpos.util.BaseLogEventWriter
-
- org.jpos.util.MappingLogEventWriter
-
- All Implemented Interfaces:
XmlConfigurable
,LogEventWriter
public class MappingLogEventWriter extends BaseLogEventWriter implements XmlConfigurable
LogEventWriter that can be configured with event and output mappers to modify the events before writing to output stream and modify the output stream before writing to the final destination respectfully. Example configuration:
<writer class="org.jpos.util.MappingLogEventWriter"> <event-mapper class="..."> <property.... /> </event-mapper> <event-mapper class="..."/> <output-mapper class="..."> <property.... /> </output-mapper> <output-mapper class="..."/> </writer>
- Since:
- 2.1.4
-
-
Constructor Summary
Constructors Constructor Description MappingLogEventWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
configureCaptureStreams()
protected void
configureEventMappers(org.jdom2.Element e)
protected void
configureOutputMappers(org.jdom2.Element e)
protected void
delegateWriteToSuper(LogEvent ev)
This method exists and is used so that we can verify the order of instructions during a call to write in unit tests.protected LogEvent
mapEvents(LogEvent ev)
protected byte[]
mapOutput(byte[] output)
void
setConfiguration(org.jdom2.Element e)
void
setPrintStream(java.io.PrintStream p)
void
write(LogEvent ev)
protected void
writeToCaptureStream(LogEvent ev)
Write to capture print stream when defined.
-
-
-
Constructor Detail
-
MappingLogEventWriter
public MappingLogEventWriter()
-
-
Method Detail
-
setPrintStream
public void setPrintStream(java.io.PrintStream p)
- Specified by:
setPrintStream
in interfaceLogEventWriter
- Overrides:
setPrintStream
in classBaseLogEventWriter
-
close
public void close()
- Specified by:
close
in interfaceLogEventWriter
- Overrides:
close
in classBaseLogEventWriter
-
write
public void write(LogEvent ev)
- Specified by:
write
in interfaceLogEventWriter
- Overrides:
write
in classBaseLogEventWriter
-
setConfiguration
public void setConfiguration(org.jdom2.Element e) throws ConfigurationException
- Specified by:
setConfiguration
in interfaceXmlConfigurable
- Parameters:
e
- Configuration element- Throws:
ConfigurationException
- on error
-
configureCaptureStreams
protected void configureCaptureStreams()
-
configureEventMappers
protected void configureEventMappers(org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
configureOutputMappers
protected void configureOutputMappers(org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
mapOutput
protected byte[] mapOutput(byte[] output)
-
delegateWriteToSuper
protected void delegateWriteToSuper(LogEvent ev)
This method exists and is used so that we can verify the order of instructions during a call to write in unit tests.- Parameters:
ev
- LogEvent to write.
-
writeToCaptureStream
protected void writeToCaptureStream(LogEvent ev)
Write to capture print stream when defined.- Parameters:
ev
- LogEvent to write.
-
-