JmsAppender.java 531 B

123456789101112131415161718192021
  1. package camel.log;
  2. import ch.qos.logback.classic.net.JMSTopicAppender;
  3. import ch.qos.logback.classic.spi.ILoggingEvent;
  4. import java.util.Map;
  5. /**
  6. * Created by l4qiang on 2017-04-12.
  7. */
  8. public class JmsAppender extends JMSTopicAppender {
  9. @Override
  10. public void append(ILoggingEvent event) {
  11. Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
  12. if (mdcPropertyMap.size() == 0) {
  13. return;
  14. }
  15. System.out.println(event.getMessage());
  16. super.append(event);
  17. }
  18. }