|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.splunk.modularinput.EventWriter
public class EventWriter
The EventWriter
class encapsulates writing events and error messages to Splunk from a modular input.
Its two important methods are writeEvent
, which takes an Event
object, and log, which takes a severity
and an error message.
Field Summary | |
---|---|
static java.lang.String |
DEBUG
|
static java.lang.String |
ERROR
|
static java.lang.String |
FATAL
|
static java.lang.String |
INFO
|
static java.lang.String |
WARN
|
Constructor Summary | |
---|---|
EventWriter()
|
|
EventWriter(java.io.Writer outputWriter,
java.io.Writer errorWriter)
|
Method Summary | |
---|---|
boolean |
checkError()
Returns whether there was an IOException on this EventWriter. |
void |
close()
Writes the closing tag to make this XML well formed. |
void |
log(java.lang.String severity,
java.lang.String errorMessage)
Logs messages about the state of this modular input to Splunk. |
void |
synchronizedLog(java.lang.String severity,
java.lang.String errorMessage)
Thread safe version of log . |
void |
synchronizedWriteEvent(Event event)
Thread safe version of writeEvent . |
void |
writeEvent(Event event)
Writes an Event object to Splunk. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String DEBUG
public static java.lang.String INFO
public static java.lang.String WARN
public static java.lang.String ERROR
public static java.lang.String FATAL
Constructor Detail |
---|
public EventWriter() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public EventWriter(java.io.Writer outputWriter, java.io.Writer errorWriter) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
Method Detail |
---|
public boolean checkError()
IOException
on this EventWriter.
EventWriter
does not throw IOException
errors, but does not ignore them entirely either. Instead it operates
the same way as PrintStream
in the standard library. You can always check if an IOException
has been thrown
by calling checkError
.
public void synchronizedWriteEvent(Event event) throws MalformedDataException
writeEvent
.
MalformedDataException
writeEvent(com.splunk.modularinput.Event)
public void writeEvent(Event event) throws MalformedDataException
Event
object to Splunk. This method is not thread safe. If you need a thread safe version, use
synchronizedWriteEvent
.
If you try to write an Event
with null data, throws MalformedDataException
.
event
- The Event
object to write.
MalformedDataException
synchronizedWriteEvent(com.splunk.modularinput.Event)
public void synchronizedLog(java.lang.String severity, java.lang.String errorMessage)
log
.
log(java.lang.String, java.lang.String)
public void log(java.lang.String severity, java.lang.String errorMessage)
severity
- The severity (e.g., EventWriter.WARN
, EventWriter.FATAL
) of this message.errorMessage
- The message that should appear in the logs.
java.io.IOException
synchronizedLog(java.lang.String, java.lang.String)
public void close()
javax.xml.stream.XMLStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |