org.eclipse.paho.client.mqttv3.logging
Class LoggerFactory

java.lang.Object
  extended by org.eclipse.paho.client.mqttv3.logging.LoggerFactory

public class LoggerFactory
extends Object

A factory that returns a logger for use by the MQTT client. The default log and trace facility uses Java's build in log facility:- java.util.logging. For systems where this is not available or where an alternative logging framework is required the logging facility can be replaced using setLogger(String) which takes an implementation of the Logger interface.


Field Summary
static String MQTT_CLIENT_MSG_CAT
          Default message catalog.
 
Constructor Summary
LoggerFactory()
           
 
Method Summary
static Logger getLogger(String messageCatalogName, String loggerID)
          Find or create a logger for a named package/class.
static String getLoggingProperty(String name)
          When run in JSR47, this allows access to the properties in the logging.properties file.
static void setLogger(String loggerClassName)
          Set the class name of the logger that the LoggerFactory will load If not set getLogger will attempt to create a logger appropriate for the platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MQTT_CLIENT_MSG_CAT

public static final String MQTT_CLIENT_MSG_CAT
Default message catalog.

See Also:
Constant Field Values
Constructor Detail

LoggerFactory

public LoggerFactory()
Method Detail

getLogger

public static Logger getLogger(String messageCatalogName,
                               String loggerID)
Find or create a logger for a named package/class. If a logger has already been created with the given name it is returned. Otherwise a new logger is created. By default a logger that uses java.util.logging will be returned.

Parameters:
messageCatalogName - the resource bundle containing the logging messages.
loggerID - unique name to identify this logger.
Returns:
a suitable Logger.
Throws:
Exception

getLoggingProperty

public static String getLoggingProperty(String name)
When run in JSR47, this allows access to the properties in the logging.properties file. If not run in JSR47, or the property isn't set, returns null.

Parameters:
name - the property to return
Returns:
the property value, or null if it isn't set or JSR47 isn't being used

setLogger

public static void setLogger(String loggerClassName)
Set the class name of the logger that the LoggerFactory will load If not set getLogger will attempt to create a logger appropriate for the platform.

Parameters:
loggerClassName - - Logger implementation class name to use.


Copyright © 2013. All Rights Reserved.