public class AmqpAppender
extends ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
A fully-configured AmqpAppender, with every option set to their defaults, would look like this:
<appender name="AMQP" class="org.springframework.amqp.rabbit.logback.AmqpAppender">
<layout>
<pattern><![CDATA[ %d %p %t [%c] - <%m>%n ]]></pattern>
</layout>
<!-- <abbreviation>36</abbreviation --> <!-- no category abbreviation by default -->
<applicationId>AmqpAppenderTest</applicationId>
<routingKeyPattern>%property{applicationId}.%c.%p</routingKeyPattern>
<generateId>true</generateId>
<charset>UTF-8</charset>
<durable>false</durable>
<deliveryMode>NON_PERSISTENT</deliveryMode>
</appender>
Modifier and Type | Class and Description |
---|---|
protected static class |
AmqpAppender.Event
Small helper class to encapsulate a LoggingEvent, its MDC properties, and the number of retries.
|
protected class |
AmqpAppender.EventSender
Helper class to actually send LoggingEvents asynchronously.
|
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_ID
Key name for the application id (if there is one set via the appender config) in the message properties.
|
static String |
CATEGORY_LEVEL
Key name for the logger level name in the message properties
|
static String |
CATEGORY_NAME
Key name for the logger category name in the message properties
|
Constructor and Description |
---|
AmqpAppender() |
Modifier and Type | Method and Description |
---|---|
protected void |
append(ch.qos.logback.classic.spi.ILoggingEvent event) |
String |
getApplicationId() |
String |
getCharset() |
String |
getContentEncoding() |
String |
getContentType() |
String |
getDeliveryMode() |
String |
getExchangeName() |
String |
getExchangeType() |
String |
getHost() |
int |
getMaxSenderRetries() |
String |
getPassword() |
int |
getPort() |
String |
getRoutingKeyPattern() |
int |
getSenderPoolSize() |
String |
getUsername() |
String |
getVirtualHost() |
boolean |
isAutoDelete() |
boolean |
isDeclareExchange() |
boolean |
isDurable() |
boolean |
isGenerateId() |
protected void |
maybeDeclareExchange()
Maybe declare the exchange.
|
Message |
postProcessMessageBeforeSend(Message message,
AmqpAppender.Event event)
Subclasses may modify the final message before sending.
|
void |
setAbbreviation(int len) |
void |
setApplicationId(String applicationId) |
void |
setAutoDelete(boolean autoDelete) |
void |
setCharset(String charset) |
void |
setContentEncoding(String contentEncoding) |
void |
setContentType(String contentType) |
void |
setDeclareExchange(boolean declareExchange) |
void |
setDeliveryMode(String deliveryMode) |
void |
setDurable(boolean durable) |
void |
setExchangeName(String exchangeName) |
void |
setExchangeType(String exchangeType) |
void |
setGenerateId(boolean generateId) |
void |
setHost(String host) |
void |
setLayout(ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout) |
void |
setMaxSenderRetries(int maxSenderRetries) |
void |
setPassword(String password) |
void |
setPort(int port) |
void |
setRoutingKeyPattern(String routingKeyPattern) |
void |
setSenderPoolSize(int senderPoolSize) |
void |
setUsername(String username) |
void |
setVirtualHost(String virtualHost) |
void |
start() |
void |
stop() |
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
public static final String APPLICATION_ID
public static final String CATEGORY_NAME
public static final String CATEGORY_LEVEL
public void setRoutingKeyPattern(String routingKeyPattern)
public String getHost()
public void setHost(String host)
public int getPort()
public void setPort(int port)
public String getVirtualHost()
public void setVirtualHost(String virtualHost)
public String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public String getExchangeName()
public void setExchangeName(String exchangeName)
public String getExchangeType()
public void setExchangeType(String exchangeType)
public String getRoutingKeyPattern()
public boolean isDeclareExchange()
public void setDeclareExchange(boolean declareExchange)
public String getContentType()
public void setContentType(String contentType)
public String getContentEncoding()
public void setContentEncoding(String contentEncoding)
public String getApplicationId()
public void setApplicationId(String applicationId)
public int getSenderPoolSize()
public void setSenderPoolSize(int senderPoolSize)
public int getMaxSenderRetries()
public void setMaxSenderRetries(int maxSenderRetries)
public boolean isDurable()
public void setDurable(boolean durable)
public String getDeliveryMode()
public void setDeliveryMode(String deliveryMode)
public boolean isAutoDelete()
public void setAutoDelete(boolean autoDelete)
public boolean isGenerateId()
public void setGenerateId(boolean generateId)
public String getCharset()
public void setCharset(String charset)
public void setLayout(ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout)
public void setAbbreviation(int len)
public void start()
start
in interface ch.qos.logback.core.spi.LifeCycle
start
in class ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
public void stop()
stop
in interface ch.qos.logback.core.spi.LifeCycle
stop
in class ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
protected void append(ch.qos.logback.classic.spi.ILoggingEvent event)
append
in class ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
protected void maybeDeclareExchange()
public Message postProcessMessageBeforeSend(Message message, AmqpAppender.Event event)
message
- The message.event
- The event.