Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.common.logging
Class Logger

    java.lang.Object
      org.modeshape.common.logging.Logger

    @ThreadSafe
    public abstract class Logger

extends Object

A simple logging interface that is fully compatible with multiple logging implementations. If no specific logging implementation is found, then its defaulted to the JDK Logger implementation. This interface does take advantage of the variable arguments and autoboxing features in Java 5, reducing the number of methods that are necessary and allowing callers to supply primitive values as parameters.

Nested Class Summary
`static class` | `Logger.Level`

Constructor Summary
`Logger()`

Method Summary
`abstract void` | `debug(String message, Object... params)` Log a message at the DEBUG level according to the specified format and (optional) parameters.
`abstract void` | `debug(Throwable t, String message, Object... params)` Log an exception (throwable) at the DEBUG level with an accompanying message.
`abstract void` | `error(I18nResource message, Object... params)` Log a message at the ERROR level according to the specified format and (optional) parameters.
`abstract void` | `error(Throwable t, I18nResource message, Object... params)` Log an exception (throwable) at the ERROR level with an accompanying message.
`static Logger` | `getLogger(Class<?> clazz)` Return a logger named corresponding to the class passed as parameter.
`static Logger` | `getLogger(String name)` Return a logger named according to the name parameter.
`static Locale` | `getLoggingLocale()` Get the locale used for the logs.
`abstract String` | `getName()` Return the name of this logger instance.
`abstract void` | `info(I18nResource message, Object... params)` Log a message at the INFO level according to the specified format and (optional) parameters.
`abstract void` | `info(Throwable t, I18nResource message, Object... params)` Log an exception (throwable) at the INFO level with an accompanying message.
`abstract boolean` | `isDebugEnabled()` Return whether messages at the DEBUG level are being logged.
`abstract boolean` | `isErrorEnabled()` Return whether messages at the ERROR level are being logged.
`abstract boolean` | `isInfoEnabled()` Return whether messages at the INFORMATION level are being logged.
`abstract boolean` | `isTraceEnabled()` Return whether messages at the TRACE level are being logged.
`abstract boolean` | `isWarnEnabled()` Return whether messages at the WARNING level are being logged.
`void` | `log(Logger.Level level, I18nResource message, Object... params)` Log a message at the supplied level according to the specified format and (optional) parameters.
`void` | `log(Logger.Level level, Throwable t, I18nResource message, Object... params)` Log an exception (throwable) at the supplied level with an accompanying message.
`static Locale` | `setLoggingLocale(Locale locale)` Set the locale used for the logs.
`abstract void` | `trace(String message, Object... params)` Log a message at the TRACE level according to the specified format and (optional) parameters.
`abstract void` | `trace(Throwable t, String message, Object... params)` Log an exception (throwable) at the TRACE level with an accompanying message.
`abstract void` | `warn(I18nResource message, Object... params)` Log a message at the WARNING level according to the specified format and (optional) parameters.
`abstract void` | `warn(Throwable t, I18nResource message, Object... params)` Log an exception (throwable) at the WARNING level with an accompanying message.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Logger

    public Logger()

Method Detail

### getLoggingLocale

    public static Locale getLoggingLocale()

  Get the locale used for the logs. If null, the `default locale` is used.

  Returns:
    the current locale used for logging, or null if the system locale is used
  See Also:
    `setLoggingLocale(Locale)`

### setLoggingLocale

    public static Locale setLoggingLocale(Locale locale)

  Set the locale used for the logs. This should be used when the logs are to be written is a specific locale, independent of the `default locale`. To use the default locale, call this method with a null value.

  Parameters:
    `locale` - the desired locale to use for the logs, or null if the system locale should be used
  Returns:
    the previous locale
  See Also:
    `getLoggingLocale()`

### getLogger

    public static Logger getLogger(Class<?> clazz)

  Return a logger named corresponding to the class passed as parameter.

  Parameters:
    `clazz` - the returned logger will be named after clazz
  Returns:
    logger

### getLogger

    public static Logger getLogger(String name)

  Return a logger named according to the name parameter.

  Parameters:
    `name` - The name of the logger.
  Returns:
    logger

### getName

    public abstract String getName()

  Return the name of this logger instance.

  Returns:
    the logger's name

### log

    public void log(Logger.Level level,
                    I18nResource message,
                    Object... params)

  Log a message at the supplied level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the desired level.

  Parameters:
    `level` - the level at which to log
    `message` - the (localized) message string
    `params` - the parameter values that are to replace the variables in the format string

### log

    public void log(Logger.Level level,
                    Throwable t,
                    I18nResource message,
                    Object... params)

  Log an exception (throwable) at the supplied level with an accompanying message. If the exception is null, then this method calls `debug(String, Object...)`.

  Parameters:
    `level` - the level at which to log
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### debug

    public abstract void debug(String message,
                               Object... params)

  Log a message at the DEBUG level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the DEBUG level.

  Parameters:
    `message` - the message string
    `params` - the parameter values that are to replace the variables in the format string

### debug

    public abstract void debug(Throwable t,
                               String message,
                               Object... params)

  Log an exception (throwable) at the DEBUG level with an accompanying message. If the exception is null, then this method calls `debug(String, Object...)`.

  Parameters:
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### error

    public abstract void error(I18nResource message,
                               Object... params)

  Log a message at the ERROR level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the ERROR level.

  Parameters:
    `message` - the message string
    `params` - the parameter values that are to replace the variables in the format string

### error

    public abstract void error(Throwable t,
                               I18nResource message,
                               Object... params)

  Log an exception (throwable) at the ERROR level with an accompanying message. If the exception is null, then this method calls `error(org.modeshape.common.i18n.I18nResource, Object...)`.

  Parameters:
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### info

    public abstract void info(I18nResource message,
                              Object... params)

  Log a message at the INFO level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the INFO level.

  Parameters:
    `message` - the message string
    `params` - the parameter values that are to replace the variables in the format string

### info

    public abstract void info(Throwable t,
                              I18nResource message,
                              Object... params)

  Log an exception (throwable) at the INFO level with an accompanying message. If the exception is null, then this method calls `info(org.modeshape.common.i18n.I18nResource, Object...)`.

  Parameters:
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### trace

    public abstract void trace(String message,
                               Object... params)

  Log a message at the TRACE level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the TRACE level.

  Parameters:
    `message` - the message string
    `params` - the parameter values that are to replace the variables in the format string

### trace

    public abstract void trace(Throwable t,
                               String message,
                               Object... params)

  Log an exception (throwable) at the TRACE level with an accompanying message. If the exception is null, then this method calls `trace(String, Object...)`.

  Parameters:
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### warn

    public abstract void warn(I18nResource message,
                              Object... params)

  Log a message at the WARNING level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient and avoids superfluous object creation when the logger is disabled for the WARNING level.

  Parameters:
    `message` - the message string
    `params` - the parameter values that are to replace the variables in the format string

### warn

    public abstract void warn(Throwable t,
                              I18nResource message,
                              Object... params)

  Log an exception (throwable) at the WARNING level with an accompanying message. If the exception is null, then this method calls `warn(org.modeshape.common.i18n.I18nResource, Object...)`.

  Parameters:
    `t` - the exception (throwable) to log
    `message` - the message accompanying the exception
    `params` - the parameter values that are to replace the variables in the format string

### isInfoEnabled

    public abstract boolean isInfoEnabled()

  Return whether messages at the INFORMATION level are being logged.

  Returns:
    true if INFORMATION log messages are currently being logged, or false otherwise.

### isWarnEnabled

    public abstract boolean isWarnEnabled()

  Return whether messages at the WARNING level are being logged.

  Returns:
    true if WARNING log messages are currently being logged, or false otherwise.

### isErrorEnabled

    public abstract boolean isErrorEnabled()

  Return whether messages at the ERROR level are being logged.

  Returns:
    true if ERROR log messages are currently being logged, or false otherwise.

### isDebugEnabled

    public abstract boolean isDebugEnabled()

  Return whether messages at the DEBUG level are being logged.

  Returns:
    true if DEBUG log messages are currently being logged, or false otherwise.

### isTraceEnabled

    public abstract boolean isTraceEnabled()

  Return whether messages at the TRACE level are being logged.

  Returns:
    true if TRACE log messages are currently being logged, or false otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.