This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Registering an application's logging instance either means creating a new mapping for it. | |
// If a mapping already exists, update its "latest update time" property. | |
private def registerApplicationInstance(String ipAddress, String hostname, String appName) { | |
if (!applications[appName]) { | |
applications[appName] = [] | |
} | |
def existing = findApplicationObject(appName, ipAddress, hostname) | |
if (!existing) { | |
// Register the new application and create a unique mapping for it. | |
applications[appName] << [ipAddress: ipAddress, hostname: hostname, lastUpdateTime: new LocalDateTime()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grails.atmosphere.mappingUri = '/atmosphere/logging' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LogMessageCommand { | |
String level | |
String threadName | |
String application | |
String message | |
String hostname | |
String ipAddress | |
LocalDateTime messageTime = new LocalDateTime() // this is joda-time | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beans = { | |
... | |
/* Attach the message adapter */ | |
logServiceActivator(LoggingServiceActivator) | |
/* Create the log channel, for internal transport */ | |
integration.channel(id: "logChannel") | |
/* Attach a chain to the log channel, this will delegate the message to the LoggingServiceActivator */ | |
integration.chain("input-channel": "logChannel") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
... | |
compile 'org.springframework.integration:spring-integration-core:2.2.0.RELEASE' | |
compile 'org.springframework.integration:spring-integration-jms:2.2.0.RELEASE' | |
compile 'org.springframework.integration:spring-integration-stream:2.2.0.RELEASE' | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beans = { | |
... | |
xmlns amq:"http://activemq.apache.org/schema/core" | |
/* Establish the broker */ | |
amq.broker(useJmx: false, persistent: false) { | |
amq.transportConnectors() { | |
amq.transportConnector(uri: "tcp://localhost:61616") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
... | |
compile 'org.apache.activemq:activemq-core:5.7.0' | |
// (this is necessary for namespace support) | |
compile 'org.apache.xbean:xbean-spring:3.12' | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you prefer Gradle | |
compile 'com.danveloper.log4j:enhanced-log4j-appender:0.1-SNAPSHOT' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log4j.rootLogger=INFO, stdout, jms | |
## Be sure that ActiveMQ messages are not logged to 'jms' appender | |
log4j.logger.org.apache.activemq=INFO, stdout | |
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %m%n | |
## Configure 'jms' appender. You'll also need jndi.properties file in order to make it work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnhancedJMSAppender extends JMSAppender { | |
private String appName; | |
/** | |
* Method enriches the headers so that JMS consumers know who you are | |
*/ | |
@Override | |
public void append(LoggingEvent event) { | |
if(!checkEntryConditions()) { | |
return; |