public class LogFileXMLReceiver extends Receiver
This receiver supports log files created using log4j's XMLLayout, as well as java.util.logging XMLFormatter (via the org.apache.log4j.spi.Decoder interface).
By default, log4j's XMLLayout is supported (no need to specify a decoder in that case).
To configure this receiver to support java.util.logging's XMLFormatter, specify a 'decoder' param of org.apache.log4j.xml.UtilLoggingXMLDecoder.
Tailing -may- work, but not in all cases (try using a file:// URL). If a process has a log file open, the receiver may be able to read and tail the file. If the process closes the file and reopens the file, the receiver may not be able to continue tailing the file.
An expressionFilter may be specified. Only events passing the expression will be forwarded to the log4j framework.
Once the event has been "posted", it will be handled by the appenders currently configured in the LoggerRespository.
thresholdLevel
active, name
repository
Constructor and Description |
---|
LogFileXMLReceiver() |
Modifier and Type | Method and Description |
---|---|
void |
activateOptions()
Process the file
|
String |
getDecoder()
Accessor
|
String |
getFileURL()
Accessor
|
String |
getFilterExpression()
Accessor
|
boolean |
isTailing()
Accessor
|
boolean |
isUseCurrentThread()
When true, this property uses the current Thread to perform the import, otherwise when false
(the default), a new Thread is created and started to manage the import.
|
static void |
main(String[] args) |
void |
setDecoder(String _decoder)
Specify the class name implementing org.apache.log4j.spi.Decoder that can process the file.
|
void |
setFileURL(String fileURL)
Specify the URL of the XML-formatted file to process.
|
void |
setFilterExpression(String filterExpression)
Set the filter expression that will cause only events which pass the filter to be forwarded
to the log4j framework.
|
void |
setTailing(boolean tailing)
Set the 'tailing' flag - may only work on file:// URLs and may stop tailing if the writing
process closes the file and reopens.
|
void |
setUseCurrentThread(boolean useCurrentThread)
Sets whether the current Thread or a new Thread is created to perform the import, the default
being false (new Thread created).
|
void |
shutdown()
Close the receiver, release any resources that are accessing the file.
|
doPost, getThreshold, isAsSevereAsThreshold, setThreshold
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, isEquivalent, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setName
getLogger, getNonFloodingLogger, resetErrorCount
public String getFileURL()
public void setFileURL(String fileURL)
fileURL
- public String getDecoder()
public void setDecoder(String _decoder)
_decoder
- public String getFilterExpression()
public boolean isTailing()
public void setTailing(boolean tailing)
tailing
- public void setFilterExpression(String filterExpression)
filterExpression
- public static void main(String[] args)
public void shutdown()
public void activateOptions()
public final boolean isUseCurrentThread()
public final void setUseCurrentThread(boolean useCurrentThread)
useCurrentThread
- Copyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.