Class TransportLoggerFactory


  • public class TransportLoggerFactory
    extends Object
    Singleton class to create TransportLogger objects. When the method getInstance() is called for the first time, a TransportLoggerControlMBean is created and registered. This MBean permits enabling and disabling the logging for all TransportLogger objects at once.
    Author:
    David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com
    See Also:
    TransportLoggerControlMBean
    • Field Detail

      • defaultLogWriterName

        public static String defaultLogWriterName
        LogWriter that will be used if none is specified.
    • Method Detail

      • getInstance

        public static TransportLoggerFactory getInstance()
        Returns a TransportLoggerFactory object which can be used to create TransportLogger objects.
        Returns:
        a TransportLoggerFactory object
      • stop

        public void stop()
      • createTransportLogger

        public TransportLogger createTransportLogger​(org.apache.activemq.transport.Transport next)
                                              throws IOException
        Creates a TransportLogger object, that will be inserted in the Transport Stack. Uses the default initial behavior, the default log writer, and creates a new log4j object to be used by the TransportLogger.
        Parameters:
        next - The next Transport layer in the Transport stack.
        Returns:
        A TransportLogger object.
        Throws:
        IOException
      • createTransportLogger

        public TransportLogger createTransportLogger​(org.apache.activemq.transport.Transport next,
                                                     org.slf4j.Logger log)
                                              throws IOException
        Creates a TransportLogger object, that will be inserted in the Transport Stack. Uses the default initial behavior and the default log writer.
        Parameters:
        next - The next Transport layer in the Transport stack.
        log - The log4j log that will be used by the TransportLogger.
        Returns:
        A TransportLogger object.
        Throws:
        IOException
      • createTransportLogger

        public TransportLogger createTransportLogger​(org.apache.activemq.transport.Transport next,
                                                     String logWriterName,
                                                     boolean useJmx,
                                                     boolean startLogging,
                                                     int jmxport)
                                              throws IOException
        Creates a TransportLogger object, that will be inserted in the Transport Stack. Creates a new log4j object to be used by the TransportLogger.
        Parameters:
        next - The next Transport layer in the Transport stack.
        startLogging - Specifies if this TransportLogger should be initially active or not.
        logWriterName - The name or the LogWriter to be used. Different log writers can output logs with a different format.
        Returns:
        A TransportLogger object.
        Throws:
        IOException
      • createTransportLogger

        public TransportLogger createTransportLogger​(org.apache.activemq.transport.Transport next,
                                                     int id,
                                                     org.slf4j.Logger log,
                                                     String logWriterName,
                                                     boolean dynamicManagement,
                                                     boolean startLogging,
                                                     int jmxport)
                                              throws IOException
        Creates a TransportLogger object, that will be inserted in the Transport Stack.
        Parameters:
        next - The next Transport layer in the Transport stack.
        id - The id of the transport logger.
        log - The log4j log that will be used by the TransportLogger.
        logWriterName - The name or the LogWriter to be used. Different log writers can output
        dynamicManagement - Specifies if JMX will be used to switch on/off the TransportLogger to be created.
        startLogging - Specifies if this TransportLogger should be initially active or not. Only has a meaning if dynamicManagement = true.
        jmxport - the port to be used by the JMX server. It should only be different from 1099 (broker's default JMX port) when it's a client that is using Transport Logging. In a broker, if the port is different from 1099, 2 JMX servers will be created, both identical, with all the MBeans.
        Returns:
        A TransportLogger object.
        Throws:
        IOException