Class JmsAppender
- java.lang.Object
-
- org.apache.logging.log4j.core.AbstractLifeCycle
-
- org.apache.logging.log4j.core.filter.AbstractFilterable
-
- org.apache.logging.log4j.core.appender.AbstractAppender
-
- org.apache.logging.log4j.core.appender.mom.JmsAppender
-
- All Implemented Interfaces:
Appender
,Filterable
,LocationAware
,LifeCycle
,LifeCycle2
@Plugin(name="JMS", category="Core", elementType="appender", printObject=true) @PluginAliases({"JMSQueue","JMSTopic"}) public class JmsAppender extends AbstractAppender
Generic JMS Appender plugin for both queues and topics. This Appender replaces the previous split ones. However, configurations set up for the 2.0 version of the JMS appenders will still work.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JmsAppender.Builder<B extends JmsAppender.Builder<B>>
-
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
-
Field Summary
Fields Modifier and Type Field Description private JmsManager
manager
-
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
-
Fields inherited from interface org.apache.logging.log4j.core.Appender
ELEMENT_TYPE, EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JmsAppender(java.lang.String name, Filter filter, Layout<? extends java.io.Serializable> layout, boolean ignoreExceptions, JmsManager manager)
Deprecated.protected
JmsAppender(java.lang.String name, Filter filter, Layout<? extends java.io.Serializable> layout, boolean ignoreExceptions, Property[] properties, JmsManager manager)
Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(LogEvent event)
Logs a LogEvent using whatever logic this Appender wishes to use.JmsManager
getManager()
static JmsAppender.Builder
newBuilder()
boolean
stop(long timeout, java.util.concurrent.TimeUnit timeUnit)
Cleanup the Filter.-
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
-
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, start, stop
-
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
-
-
-
Field Detail
-
manager
private volatile JmsManager manager
-
-
Constructor Detail
-
JmsAppender
protected JmsAppender(java.lang.String name, Filter filter, Layout<? extends java.io.Serializable> layout, boolean ignoreExceptions, Property[] properties, JmsManager manager) throws javax.jms.JMSException
Constructs a new instance.- Throws:
javax.jms.JMSException
- not thrown as of 2.9 but retained in the signature for compatibility, will be removed in 3.0
-
JmsAppender
@Deprecated protected JmsAppender(java.lang.String name, Filter filter, Layout<? extends java.io.Serializable> layout, boolean ignoreExceptions, JmsManager manager) throws javax.jms.JMSException
Deprecated.Constructs a new instance.- Throws:
javax.jms.JMSException
- not thrown as of 2.9 but retained in the signature for compatibility, will be removed in 3.0
-
-
Method Detail
-
newBuilder
@PluginBuilderFactory public static JmsAppender.Builder newBuilder()
-
append
public void append(LogEvent event)
Description copied from interface:Appender
Logs a LogEvent using whatever logic this Appender wishes to use. It is typically recommended to use a bridge pattern not only for the benefits from decoupling an Appender from its implementation, but it is also handy for sharing resources which may require some form of locking.- Parameters:
event
- The LogEvent.
-
getManager
public JmsManager getManager()
-
stop
public boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit)
Description copied from class:AbstractFilterable
Cleanup the Filter.- Specified by:
stop
in interfaceLifeCycle2
- Overrides:
stop
in classAbstractFilterable
- Parameters:
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
-