org.csstudio.logging
Class JMSLogWriter

java.lang.Object
  extended by org.csstudio.logging.JMSLogWriter

public class JMSLogWriter
extends java.lang.Object

Thread that reads log messages from queue and writes them to JMS.

Uses a Formatter, but only invokes Formatter.formatMessage() to expand parameters in the message text. If the log record contains exception info, that is added to the message text.

The remaining LogRecord elements are directly placed in the JMS log message and not formatted into (possibly) one long string via a call to Formatter.format().

Author:
Kay Kasemir

Constructor Summary
JMSLogWriter(java.lang.String application_id, java.lang.String jms_url, java.lang.String topic, java.util.concurrent.BlockingQueue<java.util.logging.LogRecord> records, java.util.logging.Formatter formatter)
          Initialize
 
Method Summary
 void onException(JMSException exception)
          JMS Exception handler
 void start()
          Start the writer's background thread
 void stop()
          Stop the writer's background thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMSLogWriter

public JMSLogWriter(java.lang.String application_id,
                    java.lang.String jms_url,
                    java.lang.String topic,
                    java.util.concurrent.BlockingQueue<java.util.logging.LogRecord> records,
                    java.util.logging.Formatter formatter)
Initialize

Parameters:
application_id - Application ID to include in JMS messages
jms_url - JMS server URL
topic - JMS topic
records - BlockingQueue from which log messages are read
formatter - Formatter that's partially used to format the message text
Method Detail

start

public void start()
Start the writer's background thread


stop

public void stop()
Stop the writer's background thread


onException

public void onException(JMSException exception)
JMS Exception handler