Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class RabbitMQAppender extends AppenderSkeleton {
private String exchange = "vcloud.logging.events";
private String appenderId = System.getProperty("HOSTNAME");
private String queueNameFormatString = "%s.%s";
private String routingString = null;
private ExecutorService workerPool = Executors.newCachedThreadPool();

public RabbitMQAppender() {
Expand Down Expand Up @@ -124,6 +125,14 @@ public String getQueueNameFormatString() {
return queueNameFormatString;
}

public String getRouteString() {
return this.routingString;
}

public void setRouteString(String route) {
this.routingString = route;
}

public void setQueueNameFormatString(String queueNameFormatString) {
this.queueNameFormatString = queueNameFormatString;
}
Expand Down Expand Up @@ -207,7 +216,7 @@ class AppenderPublisher implements Callable<LoggingEvent> {

public LoggingEvent call() throws Exception {
String id = String.format("%s:%s", appenderId, System.currentTimeMillis());
String routingKey = String.format(queueNameFormatString, event.getLevel().toString(), event.getLoggerName());
String routingKey = getRoutKey();

AMQP.BasicProperties props = new AMQP.BasicProperties();
props.setCorrelationId(id);
Expand All @@ -218,5 +227,13 @@ public LoggingEvent call() throws Exception {

return event;
}

private String getRoutKey() {
if(getRouteString() == null) {
return String.format(queueNameFormatString, event.getLevel().toString(), event.getLoggerName());
} else {
return getRouteString();
}
}
}
}