Package com.webmethods.jms.log
Class Log
- java.lang.Object
-
- com.webmethods.jms.log.Log
-
public class Log extends java.lang.Object
The Log class will manage a collection of logging categories in a global way by providing a set of static methods.The following properties may be used to configure the Log class:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Log.Level
Defines the logging level supported in the Log class.
-
Field Summary
Fields Modifier and Type Field Description static int
JMS
Category to print general purpose logs.static int
JMS_API
Category to log the public JMS interface calls.static int
JMS_AUTO_ACK
Category to log JMS API auto acknowledgementstatic int
JMS_BROKER
Category to log calls to Brokerstatic int
JMS_EVENT_RECEIVE
Category to log message/event receivestatic int
JMS_EVENT_SEND
Category to log message/event publish/sendstatic int
JMS_MARSHAL
Category to log marshal of messagesstatic int
JMS_RECONNECT
Category to log JMS API reconnectstatic int
JMS_SELECTOR
Category to log selector/filtersstatic int
JMS_TRANSPORT
Category to log message internal structuresstatic int
JMS_XA
Category to log XA transactionstatic int
JNDI_API
Category to log public JNDI interface callsstatic int
JNDI_BROKER
Category to log JNDI calls to Brokerstatic int
JNDI_STORAGE
Category to log JNDI storage operations
-
Constructor Summary
Constructors Modifier Constructor Description protected
Log(java.lang.String name)
Protected constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
addLog(int category, java.lang.String name)
Add a new Log object.static void
debug(int category, java.lang.String message)
The DEBUG logging method for String messages.static void
debug(int category, java.lang.String message, java.lang.Object arg)
The DEBUG logging method for Objects.static void
debug(java.lang.String message)
The DEBUG logging method for String messages.static void
debug(java.lang.String message, java.lang.Object arg)
The DEBUG logging method for Objects.static void
error(int category, java.lang.String message)
The ERROR logging method for String messages.static void
error(int category, java.lang.String message, java.lang.Object arg)
The ERROR logging method for Objects.static void
error(java.lang.String message)
The ERROR logging method for String messages.static void
error(java.lang.String message, java.lang.Object arg)
The ERROR logging method for Objects.static void
fatal(int category, java.lang.String message)
The FATAL logging method for String messages.static void
fatal(int category, java.lang.String message, java.lang.Object arg)
The FATAL logging method for Objects.static void
fatal(java.lang.String message)
The FATAL logging method for String messages.static void
fatal(java.lang.String message, java.lang.Object arg)
The FATAL logging method for Objects.static LogDestination
getDestination()
Gets the destination for all Log objects.static Log.Level
getLevel()
Get the logging level.static Log.Level
getLevel(int category)
Get the logging level for the given category.protected static Log
getLog(int category)
Get the Log object.static void
info(int category, java.lang.String message)
The INFO logging method for String messages.static void
info(int category, java.lang.String message, java.lang.Object arg)
The INFO logging method for Objects.static void
info(java.lang.String message)
The INFO logging method for String messages.static void
info(java.lang.String message, java.lang.Object arg)
The INFO logging method for Objects.static void
init()
Initialize the logger.static boolean
isApiLoggable()
Check if JMS_API category log messages will be logged.static boolean
isLoggable(int category, Log.Level level)
Check if a given level will be logged.static boolean
isLoggable(Log.Level level)
Check if a given level will be logged.static void
log(int category, Log.Level level, java.lang.String message)
Log a message at the specified level.static void
log(int category, Log.Level level, java.lang.String message, java.lang.Object arg)
Log a message and an object at the specified level.static void
log(Log.Level level, java.lang.String message)
Log a message at the specified level.static void
log(Log.Level level, java.lang.String message, java.lang.Object arg)
Log a message and an object at the specified level.static void
logApi(java.lang.String message)
Log a JMS_API category message.static void
logApi(java.lang.String message, java.lang.Object arg)
Log a JMS_API category message.static java.lang.String
parseLevel(Log.Level val)
Convert the enum level to the string representation of the level.static Log.Level
parseLevel(java.lang.String val)
Convert a string to an enum constant.static void
setDestination(java.lang.String name)
Sets the destination for all Log objects.static void
setLevel(int category, Log.Level level)
Set the logging level.static void
setLevel(Log.Level level)
Set the logging level.static void
verbose(int category, java.lang.String message)
The VERBOSE logging method for String messages.static void
verbose(int category, java.lang.String message, java.lang.Object arg)
The VERBOSE logging method for Objects.static void
verbose(java.lang.String message)
The VERBOSE logging method for String messages.static void
verbose(java.lang.String message, java.lang.Object arg)
The VERBOSE logging method for Objects.static void
warning(int category, java.lang.String message)
The WARNING logging method for String messages.static void
warning(int category, java.lang.String message, java.lang.Object arg)
The WARNING logging method for Objects.static void
warning(java.lang.String message)
The WARNING logging method for String messages.static void
warning(java.lang.String message, java.lang.Object arg)
The WARNING logging method for Objects.
-
-
-
Field Detail
-
JMS
public static final int JMS
Category to print general purpose logs.- See Also:
- Constant Field Values
-
JMS_API
public static final int JMS_API
Category to log the public JMS interface calls.- See Also:
- Constant Field Values
-
JMS_XA
public static final int JMS_XA
Category to log XA transaction- See Also:
- Constant Field Values
-
JMS_EVENT_SEND
public static final int JMS_EVENT_SEND
Category to log message/event publish/send- See Also:
- Constant Field Values
-
JMS_EVENT_RECEIVE
public static final int JMS_EVENT_RECEIVE
Category to log message/event receive- See Also:
- Constant Field Values
-
JMS_SELECTOR
public static final int JMS_SELECTOR
Category to log selector/filters- See Also:
- Constant Field Values
-
JMS_BROKER
public static final int JMS_BROKER
Category to log calls to Broker- See Also:
- Constant Field Values
-
JMS_TRANSPORT
public static final int JMS_TRANSPORT
Category to log message internal structures- See Also:
- Constant Field Values
-
JMS_MARSHAL
public static final int JMS_MARSHAL
Category to log marshal of messages- See Also:
- Constant Field Values
-
JNDI_API
public static final int JNDI_API
Category to log public JNDI interface calls- See Also:
- Constant Field Values
-
JNDI_STORAGE
public static final int JNDI_STORAGE
Category to log JNDI storage operations- See Also:
- Constant Field Values
-
JNDI_BROKER
public static final int JNDI_BROKER
Category to log JNDI calls to Broker- See Also:
- Constant Field Values
-
JMS_RECONNECT
public static final int JMS_RECONNECT
Category to log JMS API reconnect- See Also:
- Constant Field Values
-
JMS_AUTO_ACK
public static final int JMS_AUTO_ACK
Category to log JMS API auto acknowledgement- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init()
Initialize the logger. This method should be called to re-initialize logger after configurations have been changed.
-
addLog
protected static void addLog(int category, java.lang.String name)
Add a new Log object.- Parameters:
category
- The category of the Log object.name
- The name of the Log object.
-
getLog
protected static Log getLog(int category)
Get the Log object. No need to be synchronized since no more Log Log objects can be added following initialization.- Parameters:
category
- The category of the Log object to get.- Returns:
- The Log object.
-
setLevel
public static void setLevel(Log.Level level)
Set the logging level.- Parameters:
level
- The level to set.
-
setLevel
public static void setLevel(int category, Log.Level level)
Set the logging level.- Parameters:
category
- The category of the Log object.level
- The level to set.
-
getLevel
public static Log.Level getLevel()
Get the logging level.- Returns:
- The level.
-
getLevel
public static Log.Level getLevel(int category)
Get the logging level for the given category.- Parameters:
category
- The category of the Log object.- Returns:
- The level.
-
isApiLoggable
public static boolean isApiLoggable()
Check if JMS_API category log messages will be logged.- Returns:
true
if API log messages will be logged.- See Also:
logApi(String)
,logApi(String, Object)
-
logApi
public static void logApi(java.lang.String message)
Log a JMS_API category message.- Parameters:
message
- The message to log.- See Also:
isApiLoggable()
-
logApi
public static void logApi(java.lang.String message, java.lang.Object arg)
Log a JMS_API category message.- Parameters:
message
- The message to log.- See Also:
isApiLoggable()
-
isLoggable
public static boolean isLoggable(Log.Level level)
Check if a given level will be logged.- Parameters:
level
- The level to check.- Returns:
true
if the level will be logged.
-
isLoggable
public static boolean isLoggable(int category, Log.Level level)
Check if a given level will be logged.- Parameters:
category
- The category of the Log object.level
- The level to check.- Returns:
true
if the level will be logged.
-
log
public static void log(Log.Level level, java.lang.String message)
Log a message at the specified level.- Parameters:
level
- The logging level.message
- The message to log.
-
log
public static void log(int category, Log.Level level, java.lang.String message)
Log a message at the specified level.- Parameters:
category
- The category of the Log object.level
- The logging level.message
- The message to log.
-
log
public static void log(Log.Level level, java.lang.String message, java.lang.Object arg)
Log a message and an object at the specified level. The object'stoString
method is called unless the object is an instance of Throwable which will result in the exception's stack trace being printed.- Parameters:
level
- The logging level.message
- The message to log.arg
- An object to log.
-
log
public static void log(int category, Log.Level level, java.lang.String message, java.lang.Object arg)
Log a message and an object at the specified level. The object'stoString
method is called unless the object is an instance of Throwable which will result in the exception's stack trace being printed.- Parameters:
category
- The category of the Log object.level
- The logging level.message
- The message to log.arg
- An object to log.
-
fatal
public static void fatal(java.lang.String message)
The FATAL logging method for String messages.- Parameters:
message
- The message to log.
-
fatal
public static void fatal(java.lang.String message, java.lang.Object arg)
The FATAL logging method for Objects.- Parameters:
arg
- The object to log.
-
fatal
public static void fatal(int category, java.lang.String message)
The FATAL logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
fatal
public static void fatal(int category, java.lang.String message, java.lang.Object arg)
The FATAL logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
error
public static void error(java.lang.String message)
The ERROR logging method for String messages.- Parameters:
message
- The message to log.
-
error
public static void error(java.lang.String message, java.lang.Object arg)
The ERROR logging method for Objects.- Parameters:
arg
- The object to log.
-
error
public static void error(int category, java.lang.String message)
The ERROR logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
error
public static void error(int category, java.lang.String message, java.lang.Object arg)
The ERROR logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
warning
public static void warning(java.lang.String message)
The WARNING logging method for String messages.- Parameters:
message
- The message to log.
-
warning
public static void warning(java.lang.String message, java.lang.Object arg)
The WARNING logging method for Objects.- Parameters:
arg
- The object to log.
-
warning
public static void warning(int category, java.lang.String message)
The WARNING logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
warning
public static void warning(int category, java.lang.String message, java.lang.Object arg)
The WARNING logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
info
public static void info(java.lang.String message)
The INFO logging method for String messages.- Parameters:
message
- The message to log.
-
info
public static void info(java.lang.String message, java.lang.Object arg)
The INFO logging method for Objects.- Parameters:
arg
- The object to log.
-
info
public static void info(int category, java.lang.String message)
The INFO logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
info
public static void info(int category, java.lang.String message, java.lang.Object arg)
The INFO logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
verbose
public static void verbose(java.lang.String message)
The VERBOSE logging method for String messages.- Parameters:
message
- The message to log.
-
verbose
public static void verbose(java.lang.String message, java.lang.Object arg)
The VERBOSE logging method for Objects.- Parameters:
arg
- The object to log.
-
verbose
public static void verbose(int category, java.lang.String message)
The VERBOSE logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
verbose
public static void verbose(int category, java.lang.String message, java.lang.Object arg)
The VERBOSE logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
debug
public static void debug(java.lang.String message)
The DEBUG logging method for String messages.- Parameters:
message
- The message to log.
-
debug
public static void debug(java.lang.String message, java.lang.Object arg)
The DEBUG logging method for Objects.- Parameters:
arg
- The object to log.
-
debug
public static void debug(int category, java.lang.String message)
The DEBUG logging method for String messages.- Parameters:
category
- The category of the Log object.message
- The message to log.
-
debug
public static void debug(int category, java.lang.String message, java.lang.Object arg)
The DEBUG logging method for Objects.- Parameters:
category
- The category of the Log object.arg
- The object to log.
-
setDestination
public static void setDestination(java.lang.String name)
Sets the destination for all Log objects.- Parameters:
name
- The class name of the LogDestination to set.
-
getDestination
public static LogDestination getDestination()
Gets the destination for all Log objects.- Returns:
- The destination.
-
parseLevel
public static Log.Level parseLevel(java.lang.String val)
Convert a string to an enum constant.- Parameters:
val
- A string representing a level.- Returns:
- the log level represented by the string level.
- Throws:
java.lang.IllegalArgumentException
- If val is not a valid level.
-
parseLevel
public static java.lang.String parseLevel(Log.Level val)
Convert the enum level to the string representation of the level.- Parameters:
val
- An enum level.- Returns:
- The string representation of the level.
-
-