flux.logging
Interface Logger


public interface Logger

Abstract interface for logging to the various supported logger types.

Author:
Copyright 2014 Flux Corporation. All rights reserved.
See Also:
LoggerType

Method Summary
 void config(java.lang.String message)
          Logs a message at the CONFIG level.
 void fine(java.lang.String message)
          Logs a message at the FINE level.
 void finer(java.lang.String message)
          Logs a message at the FINER level.
 void finest(java.lang.String message)
          Logs a message at the FINEST level.
 java.lang.Object getRawLogger()
          Returns either a JDK or LOG4J logger object, depending on which of those loggers has been configured for use.
 java.util.Set getRawLoggers()
          Returns a set of logger objects that have been been configured for use.
 void info(java.lang.String message)
          Logs a message at the INFO level.
 boolean isLoggable(Level level)
          Returns true if and only if logging is enabled at a level that is equal to or less than the specfied level.
 boolean isLoggable(Level level, LoggerType loggerType)
          Returns true if and only if logging is enabled at a level that is equal to or less than the specfied level and one of the configured loggers matches the specified logger type.
 void log(Level level, java.lang.String message)
          Logs a message at the specified level.
 void log(Level level, java.lang.String message, java.lang.Object[] arguments)
          Logs a message at the specified level.
 void log(Level level, java.lang.String message, java.lang.Throwable throwable)
          Logs a message and a Throwable object at the specified level.
 void log(Level level, java.lang.Throwable throwable)
          Logs a Throwable object at the specified level.
 void severe(java.lang.String message)
          Logs a message at the SEVERE level.
 void warning(java.lang.String message)
          Logs a message at the WARNING level.
 

Method Detail

config

void config(java.lang.String message)
Logs a message at the CONFIG level.

Parameters:
message - The message to log.

fine

void fine(java.lang.String message)
Logs a message at the FINE level.

Parameters:
message - The message to log.

finer

void finer(java.lang.String message)
Logs a message at the FINER level.

Parameters:
message - The message to log.

finest

void finest(java.lang.String message)
Logs a message at the FINEST level.

Parameters:
message - The message to log.

getRawLogger

java.lang.Object getRawLogger()
                              throws java.lang.IllegalStateException
Returns either a JDK or LOG4J logger object, depending on which of those loggers has been configured for use. The returned object must be cast to the appropriate class for use. If either the NULL or STANDARD_ERROR logger has been configured, this method returns null.

Returns:
Either a JDK or Log4j logger object, depending on which of those loggers has been configured for use. May be null.
Throws:
java.lang.IllegalStateException - If multiple loggers are configured.
See Also:
LoggerType

getRawLoggers

java.util.Set getRawLoggers()
Returns a set of logger objects that have been been configured for use. Each returned logger object must be cast to the appropriate class for use. If any of the NULL, INTERNAL_ASYNCHRONOUS, INTERNAL_SYNCHRONOUS, COMMONS, or STANDARD_ERROR loggers have been configured, this method will not return their corresponding logger objects. The maximum size of the set is two.

Returns:
Set of Object. A set that contains JDK and LOG4J logger objects, depending on which of those loggers has been configured for use. The maximum size of the set is two. The set may be empty if no JDK or LOG4J loggers have been configured.
See Also:
LoggerType

info

void info(java.lang.String message)
Logs a message at the INFO level. This level is the default for the JDK and Log4j loggers.

Parameters:
message - The message to log.

isLoggable

boolean isLoggable(Level level)
                   throws java.lang.IllegalStateException
Returns true if and only if logging is enabled at a level that is equal to or less than the specfied level. For example, if the logging is enabled at the INFO level, passing SEVERE (the highest level) into this method returns true. However, passing FINEST (the lowest level) into this method returns false.

Parameters:
level - A logging level.
Returns:
Whether logging is enabled at a level that is equal to or less than the specfied level.
Throws:
java.lang.IllegalStateException - If multiple loggers are configured.

isLoggable

boolean isLoggable(Level level,
                   LoggerType loggerType)
                   throws java.lang.IllegalArgumentException
Returns true if and only if logging is enabled at a level that is equal to or less than the specfied level and one of the configured loggers matches the specified logger type.

For example, if logging is enabled at the INFO level with the JDK and LOG4J loggers, passing SEVERE (the highest level) into this method with the JDK logger type returns true. However, passing SEVERE into this method with the COMMONS_LOGGING logger type returns false. Also, passing FINEST (the lowest level) into this method returns false.

Parameters:
level - A logging level.
loggerType - A logger type.
Returns:
Whether logging is enabled at a level that is equal to or less than the specfied level and one of the configured loggers matches the specified logger type.
Throws:
java.lang.IllegalArgumentException - If loggerType does not match the configured logger type.

log

void log(Level level,
         java.lang.String message)
Logs a message at the specified level.

Parameters:
level - The level at which to log the message.
message - The message to log.

log

void log(Level level,
         java.lang.String message,
         java.lang.Object[] arguments)
Logs a message at the specified level.

Parameters:
level - The level at which to log the message.
message - The message to log.
arguments - The objects to log.

log

void log(Level level,
         java.lang.String message,
         java.lang.Throwable throwable)
Logs a message and a Throwable object at the specified level.

Parameters:
level - The level at which to log the message.
message - The message to log.
throwable - The Throwable object to log.

log

void log(Level level,
         java.lang.Throwable throwable)
Logs a Throwable object at the specified level.

Parameters:
level - The level at which to log the message.
throwable - The Throwable object to log.

severe

void severe(java.lang.String message)
Logs a message at the SEVERE level.

Parameters:
message - The message to log.

warning

void warning(java.lang.String message)
Logs a message at the WARNING level.

Parameters:
message - The message to log.


© 2014 Flux Corporation. All rights reserved.