org.eclipse.paho.client.mqttv3.logging
Interface Logger

All Known Implementing Classes:
JSR47Logger

public interface Logger

A Logger object is used to send log and trace messages to a platform specific logging implementation. Loggers are named, using a hierarchical dot-separated name-space. Logger names can be arbitrary strings, but they should normally be based on the component or the package name of the logged component Logger objects may be obtained by calls on one of the getLogger factory methods. These will either create a new Logger or return a suitable existing Logger.

The int levels define a set of standard logging levels that can be used to control logging output. The logging levels are ordered and are specified by ordered integers. Enabling logging at a given level also enables logging at all higher levels.

Clients should use the the convenience methods such as severe() and fine() or one of the predefined level constants such as Logger.SEVERE and Logger.FINE with the appropriate log(int level...) or trace(int level...) methods.

The levels in descending order are:


Field Summary
static int CONFIG
          CONFIG is a message level for static configuration messages.
static int FINE
          FINE is a message level providing tracing information.
static int FINER
          FINER indicates a fairly detailed tracing message.
static int FINEST
          FINEST indicates a highly detailed tracing message.
static int INFO
          INFO is a message level for informational messages.
static int SEVERE
          SEVERE is a message level indicating a serious failure.
static int WARNING
          WARNING is a message level indicating a potential problem.
 
Method Summary
 void config(String sourceClass, String sourceMethod, String msg)
          Log a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void config(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void config(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable thrown)
          Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 void dumpTrace()
           
 void fine(String sourceClass, String sourceMethod, String msg)
          Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void fine(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void fine(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable ex)
           
 void finer(String sourceClass, String sourceMethod, String msg)
          Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void finer(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void finer(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable ex)
           
 void finest(String sourceClass, String sourceMethod, String msg)
          Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void finest(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void finest(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable ex)
           
 String formatMessage(String msg, Object[] inserts)
          Format a log message without causing it to be written to the log.
 void info(String sourceClass, String sourceMethod, String msg)
          Log a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void info(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void info(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable thrown)
          Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 void initialise(ResourceBundle messageCatalog, String loggerID, String resourceName)
           
 boolean isLoggable(int level)
          Check if a message of the given level would actually be logged by this logger.
 void log(int level, String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable thrown)
          Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 void setResourceName(String logContext)
          Set a name that can be used to provide context with each log record.
 void severe(String sourceClass, String sourceMethod, String msg)
          Log a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void severe(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void severe(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable thrown)
          Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 void trace(int level, String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable ex)
          Log a trace message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 void warning(String sourceClass, String sourceMethod, String msg)
          Log a message, specifying source class and method, if the logger is currently enabled for the given message level.
 void warning(String sourceClass, String sourceMethod, String msg, Object[] inserts)
          Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.
 void warning(String sourceClass, String sourceMethod, String msg, Object[] inserts, Throwable thrown)
          Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.
 

Field Detail

SEVERE

static final int SEVERE
SEVERE is a message level indicating a serious failure.

In general SEVERE messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.

See Also:
Constant Field Values

WARNING

static final int WARNING
WARNING is a message level indicating a potential problem.

In general WARNING messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.

See Also:
Constant Field Values

INFO

static final int INFO
INFO is a message level for informational messages.

Typically INFO messages will be written to the console or its equivalent. So the INFO level should only be used for reasonably significant messages that will make sense to end users and system admins.

See Also:
Constant Field Values

CONFIG

static final int CONFIG
CONFIG is a message level for static configuration messages.

CONFIG messages are intended to provide a variety of static configuration information, to assist in debugging problems that may be associated with particular configurations. For example, CONFIG message might include the CPU type, the graphics depth, the GUI look-and-feel, etc.

See Also:
Constant Field Values

FINE

static final int FINE
FINE is a message level providing tracing information.

All of FINE, FINER, and FINEST are intended for relatively detailed tracing. The exact meaning of the three levels will vary between subsystems, but in general, FINEST should be used for the most voluminous detailed output, FINER for somewhat less detailed output, and FINE for the lowest volume (and most important) messages.

In general the FINE level should be used for information that will be broadly interesting to developers who do not have a specialized interest in the specific subsystem.

FINE messages might include things like minor (recoverable) failures. Issues indicating potential performance problems are also worth logging as FINE.

See Also:
Constant Field Values

FINER

static final int FINER
FINER indicates a fairly detailed tracing message. By default logging calls for entering, returning, or throwing an exception are traced at this level.

See Also:
Constant Field Values

FINEST

static final int FINEST
FINEST indicates a highly detailed tracing message.

See Also:
Constant Field Values
Method Detail

initialise

void initialise(ResourceBundle messageCatalog,
                String loggerID,
                String resourceName)

setResourceName

void setResourceName(String logContext)
Set a name that can be used to provide context with each log record. This overrides the value passed in on initialise


isLoggable

boolean isLoggable(int level)
Check if a message of the given level would actually be logged by this logger. This check is based on the Loggers effective level, which may be inherited from its parent.

Parameters:
level - a message logging level.
Returns:
true if the given message level is currently being logged.

severe

void severe(String sourceClass,
            String sourceMethod,
            String msg)
Log a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used.

severe

void severe(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts)
Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

severe

void severe(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts,
            Throwable thrown)
Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.
thrown - Throwable associated with log message.

warning

void warning(String sourceClass,
             String sourceMethod,
             String msg)
Log a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used.

warning

void warning(String sourceClass,
             String sourceMethod,
             String msg,
             Object[] inserts)
Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

warning

void warning(String sourceClass,
             String sourceMethod,
             String msg,
             Object[] inserts,
             Throwable thrown)
Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.
thrown - Throwable associated with log message.

info

void info(String sourceClass,
          String sourceMethod,
          String msg)
Log a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used.

info

void info(String sourceClass,
          String sourceMethod,
          String msg,
          Object[] inserts)
Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

info

void info(String sourceClass,
          String sourceMethod,
          String msg,
          Object[] inserts,
          Throwable thrown)
Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.
thrown - Throwable associated with log message.

config

void config(String sourceClass,
            String sourceMethod,
            String msg)
Log a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used.

config

void config(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts)
Log a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

config

void config(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts,
            Throwable thrown)
Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.
thrown - Throwable associated with log message.

fine

void fine(String sourceClass,
          String sourceMethod,
          String msg)
Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used.

fine

void fine(String sourceClass,
          String sourceMethod,
          String msg,
          Object[] inserts)
Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

fine

void fine(String sourceClass,
          String sourceMethod,
          String msg,
          Object[] inserts,
          Throwable ex)

finer

void finer(String sourceClass,
           String sourceMethod,
           String msg)
Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used.

finer

void finer(String sourceClass,
           String sourceMethod,
           String msg,
           Object[] inserts)
Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

finer

void finer(String sourceClass,
           String sourceMethod,
           String msg,
           Object[] inserts,
           Throwable ex)

finest

void finest(String sourceClass,
            String sourceMethod,
            String msg)
Trace a message, specifying source class and method, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used.

finest

void finest(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts)
Trace a message, specifying source class and method, with an array of object arguments, if the logger is currently enabled for the given message level.

Parameters:
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.

finest

void finest(String sourceClass,
            String sourceMethod,
            String msg,
            Object[] inserts,
            Throwable ex)

log

void log(int level,
         String sourceClass,
         String sourceMethod,
         String msg,
         Object[] inserts,
         Throwable thrown)
Log a message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
level - One of the message level identifiers, e.g. SEVERE.
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message, may be null.
thrown - Throwable associated with log message.

trace

void trace(int level,
           String sourceClass,
           String sourceMethod,
           String msg,
           Object[] inserts,
           Throwable ex)
Log a trace message, specifying source class and method, with an array of object arguments and a throwable, if the logger is currently enabled for the given message level.

Parameters:
level - One of the message level identifiers, e.g. SEVERE.
sourceClass - Name of class that issued the logging request.
sourceMethod - Name of method that issued the logging request.
msg - The key in the message catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message, may be null.

formatMessage

String formatMessage(String msg,
                     Object[] inserts)
Format a log message without causing it to be written to the log.

Parameters:
msg - The key in the message localization catalog for the message or the actual message itself. During formatting, if the logger has a mapping for the msg string, then the msg string is replaced by the localized value. Otherwise the original msg string is used. The formatter uses java.text.MessageFormat style formatting to format parameters, so for example a format string "{0} {1}" would format two inserts into the message.
inserts - Array of parameters to the message.
Returns:
The formatted message for the current locale.

dumpTrace

void dumpTrace()


Copyright © 2013. All Rights Reserved.