Child pages
  • Sumo log appender change log consumer esb listener

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
spaceKeyGrouper
pageTitleNavigation


Get the jar (no dependencies)

https://github.com/SumoLogic/sumo-log4j-appender

https://repo1.maven.org/maven2/com/sumologic/plugins/log4j/sumo-log4j-appender/2.12/sumo-log4j-appender-2.12.jar


Java of the listener

Code Block
/**
 * @author mchyzer
 * $Id$
 */
package edu.columbia.sumoLog;

import org.apache.commons.logging.Log;

import edu.internet2.middleware.grouper.esb.listener.EsbListenerBase;
import edu.internet2.middleware.grouper.util.GrouperUtil;


/**
 *
 */
public class ColumbiaSumoLogAppender extends EsbListenerBase {

  /** logger */
  private static final Log LOG = GrouperUtil.getLog(ColumbiaSumoLogAppender.class);

  /**
   * 
   */
  public ColumbiaSumoLogAppender() {
  }

  /**
   * @see edu.internet2.middleware.grouper.esb.listener.EsbListenerBase#dispatchEvent(java.lang.String, java.lang.String)
   */
  @Override
  public boolean dispatchEvent(String eventJsonString, String consumerName) {
    
    LOG.debug(eventJsonString);
    
    return true;
  }

  /**
   * @see edu.internet2.middleware.grouper.esb.listener.EsbListenerBase#disconnect()
   */
  @Override
  public void disconnect() {
  }

}

Configure log4j.properties

Code Block
## Log messages to stderr
log4j.appender.sumo                           = com.sumologic.log4j.SumoLogicAppender
log4j.appender.sumo.layout                    = org.apache.log4j.PatternLayout
log4j.appender.sumo.layout.ConversionPattern  = %d{yyyy-MM-dd HH:mm:ss,SSS Z} [%t] %-5p %c - %m%n
log4j.appender.sumo.url                       =<YOUR_URL_HERE>
# Optional parameters for Metadata
log4j.appender.sumo.sourceName                =<YOUR SOURCE NAME>
log4j.appender.sumo.sourceHost                =<YOUR SOURCE HOST>
log4j.appender.sumo.sourceCategory            =<YOUR SOURCE CATEGORY>


log4j.logger.edu.columbia.sumoLog.ColumbiaSumoLogAppender = DEBUG, sumo
log4j.additivity.edu.columbia.sumoLog.ColumbiaSumoLogAppender = false


Configure grouper-loader.properties


Code Block
changeLog.consumer.boxEsb.class = edu.internet2.middleware.grouper.changeLog.esb.consumer.EsbConsumer
changeLog.consumer.boxEsb.quartzCron = 0 * * * * ?
#changeLog.consumer.boxEsb.elfilter = 
changeLog.consumer.boxEsb.publisher.class = edu.columbia.sumoLog.ColumbiaSumoLogAppender