public final class LogUtils extends Object
AbstractDelegatingLogger
, and advertise that class
via one of the following mechanisms:
setLoggerClass(Class)
with a Class> reference to the logger class.Log4jLogger
to use log4j instead of java.util.logging.Modifier and Type | Method and Description |
---|---|
protected static Logger |
createLogger(Class<?> cls,
String name,
String loggerName)
Create a logger
|
static Logger |
getL7dLogger(Class<?> cls)
Get a Logger with the associated default resource bundle for the class.
|
static Logger |
getL7dLogger(Class<?> cls,
String resourcename)
Get a Logger with an associated resource bundle.
|
static Logger |
getL7dLogger(Class<?> cls,
String resourcename,
String loggerName)
Get a Logger with an associated resource bundle.
|
static Logger |
getLogger(Class<?> cls)
Get a Logger with the associated default resource bundle for the class.
|
static Logger |
getLogger(Class<?> cls,
String resourcename)
Get a Logger with an associated resource bundle.
|
static Logger |
getLogger(Class<?> cls,
String resourcename,
String loggerName)
Get a Logger with an associated resource bundle.
|
static void |
log(Logger logger,
Level level,
String message)
Checks log level and logs
|
static void |
log(Logger logger,
Level level,
String message,
Object parameter)
Checks log level and logs
|
static void |
log(Logger logger,
Level level,
String message,
Object[] parameters)
Checks log level and logs
|
static void |
log(Logger logger,
Level level,
String message,
Throwable throwable)
Checks log level and logs
|
static void |
log(Logger logger,
Level level,
String message,
Throwable throwable,
Object... parameters)
Allows both parameter substitution and a typed Throwable to be logged.
|
static void |
log(Logger logger,
Level level,
String message,
Throwable throwable,
Object parameter)
Allows both parameter substitution and a typed Throwable to be logged.
|
static void |
setLoggerClass(Class<? extends AbstractDelegatingLogger> cls)
Specify a logger class that inherits from
AbstractDelegatingLogger . |
public static final String KEY
public static void setLoggerClass(Class<? extends AbstractDelegatingLogger> cls)
AbstractDelegatingLogger
.
Enable users to use their own logger implementation.public static Logger getLogger(Class<?> cls)
cls
- the Class to contain the Loggerpublic static Logger getLogger(Class<?> cls, String resourcename)
cls
- the Class to contain the Loggerresourcename
- the resource namepublic static Logger getLogger(Class<?> cls, String resourcename, String loggerName)
cls
- the Class to contain the Logger (to find resources)resourcename
- the resource nameloggerName
- the full name for the loggerpublic static Logger getL7dLogger(Class<?> cls)
cls
- the Class to contain the Loggerpublic static Logger getL7dLogger(Class<?> cls, String resourcename)
cls
- the Class to contain the Loggerresourcename
- the resource namepublic static Logger getL7dLogger(Class<?> cls, String resourcename, String loggerName)
cls
- the Class to contain the Logger (to find resources)resourcename
- the resource nameloggerName
- the full name for the loggerprotected static Logger createLogger(Class<?> cls, String name, String loggerName)
public static void log(Logger logger, Level level, String message, Throwable throwable, Object parameter)
logger
- the Logger the log tolevel
- the severity levelmessage
- the log messagethrowable
- the Throwable to logparameter
- the parameter to substitute into messagepublic static void log(Logger logger, Level level, String message, Throwable throwable, Object... parameters)
logger
- the Logger the log tolevel
- the severity levelmessage
- the log messagethrowable
- the Throwable to logparameters
- the parameters to substitute into messagepublic static void log(Logger logger, Level level, String message)
logger
- the Logger the log tolevel
- the severity levelmessage
- the log messagepublic static void log(Logger logger, Level level, String message, Throwable throwable)
logger
- the Logger the log tolevel
- the severity levelmessage
- the log messagethrowable
- the Throwable to logpublic static void log(Logger logger, Level level, String message, Object parameter)
logger
- the Logger the log tolevel
- the severity levelmessage
- the log messageparameter
- the parameter to substitute into messageApache CXF