com.simba.dsi.core.impl
Class DSILogger

java.lang.Object
  extended by com.simba.dsi.core.impl.DSILogger
All Implemented Interfaces:
com.simba.support.ILogger

public class DSILogger
extends java.lang.Object
implements com.simba.support.ILogger

DSILogger logs messages to a log writer. The log entry will include the following details:

<Date><Time>[<Milliseconds>] <ThreadID> <LogLevel> <ClassName>::<FunctionName>: <Message>

The log entry details should be formatted similar to:

Mar 27 23:59:59.399 23 DEBUG DSILogger.LogString: This is a test


Field Summary
static java.lang.String LOG_PRINT_WRITER_KEY
          The log print writer settings key.
 
Constructor Summary
DSILogger(java.lang.String fileName)
          Constructor.
 
Method Summary
 java.lang.String getFileName()
          Gets the log file name being used.
 java.util.Locale getLocale()
          Gets the locale for this logger.
 com.simba.support.LogLevel getLogLevel()
          Get the level of logging done by the ILogger.
 boolean isEnabled()
          Determine if the logger is enabled.
 void logDebug(java.lang.String packageName, java.lang.String className, java.lang.String methodName, com.simba.support.exceptions.ErrorException error)
          If the log level is greater than or equal to DEBUG, log the message.
 void logDebug(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to DEBUG, log the message.
 void logError(java.lang.String packageName, java.lang.String className, java.lang.String methodName, com.simba.support.exceptions.ErrorException error)
          Initializes logger, if it isn't already.
 void logError(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to ERROR, log the message.
 void logFatal(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to FATAL, log the message.
 void logFunctionEntrance(java.lang.String packageName, java.lang.String className, java.lang.String methodName)
          If the log level is TRACE, logs something similar to: <className><methodName> +++++ enter +++++
 void logInfo(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to INFO, log the message.
 void logTrace(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to TRACE, log the message, then log a stack trace.
 void logWarning(java.lang.String packageName, java.lang.String className, java.lang.String methodName, java.lang.String message)
          If the log level is greater than or equal to WARNING, log the message.
 void prepareSettings(java.lang.String fileName)
          Sets up the logging with the appropriate settings.
 void setLocale(java.util.Locale locale)
          Sets the locale for this logger.
 void setLogLevel(com.simba.support.LogLevel logLevel)
          Set the level of logging done by the ILogger.
 void setLogPackage(java.lang.String logPackage)
          Enables/disables package-restricted logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_PRINT_WRITER_KEY

public static final java.lang.String LOG_PRINT_WRITER_KEY
The log print writer settings key.

See Also:
Constant Field Values
Constructor Detail

DSILogger

public DSILogger(java.lang.String fileName)
Constructor. Will append a .log file extension to the provided file name if no extension is provided.

Parameters:
fileName - The name of the file to log to. This name should not include the file path.
Method Detail

getFileName

public java.lang.String getFileName()
Gets the log file name being used. This method does not return the full path of the file, just the file name.

Returns:
The log filename.

getLocale

public java.util.Locale getLocale()
Gets the locale for this logger.

Specified by:
getLocale in interface com.simba.support.ILogger
Returns:
The locale for this logger.
See Also:
for valid values.

getLogLevel

public com.simba.support.LogLevel getLogLevel()
Get the level of logging done by the ILogger.

Specified by:
getLogLevel in interface com.simba.support.ILogger
Returns:
The level of logging done.

isEnabled

public boolean isEnabled()
Determine if the logger is enabled.

Specified by:
isEnabled in interface com.simba.support.ILogger
Returns:
true if the logger is enabled; false otherwise.

logDebug

public void logDebug(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     com.simba.support.exceptions.ErrorException error)
If the log level is greater than or equal to DEBUG, log the message.

Specified by:
logDebug in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
error - The error to log.

logDebug

public void logDebug(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     java.lang.String message)
If the log level is greater than or equal to DEBUG, log the message.

Specified by:
logDebug in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

logError

public void logError(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     com.simba.support.exceptions.ErrorException error)
Initializes logger, if it isn't already. If the log level is greater than or equal to ERROR, log the message.

Specified by:
logError in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
error - The error to log.

logError

public void logError(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     java.lang.String message)
If the log level is greater than or equal to ERROR, log the message.

Specified by:
logError in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

logFatal

public void logFatal(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     java.lang.String message)
If the log level is greater than or equal to FATAL, log the message.

Specified by:
logFatal in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

logFunctionEntrance

public void logFunctionEntrance(java.lang.String packageName,
                                java.lang.String className,
                                java.lang.String methodName)
If the log level is TRACE, logs something similar to: <className><methodName> +++++ enter +++++

Specified by:
logFunctionEntrance in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.

logInfo

public void logInfo(java.lang.String packageName,
                    java.lang.String className,
                    java.lang.String methodName,
                    java.lang.String message)
If the log level is greater than or equal to INFO, log the message.

Specified by:
logInfo in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

logTrace

public void logTrace(java.lang.String packageName,
                     java.lang.String className,
                     java.lang.String methodName,
                     java.lang.String message)
If the log level is greater than or equal to TRACE, log the message, then log a stack trace.

Specified by:
logTrace in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

logWarning

public void logWarning(java.lang.String packageName,
                       java.lang.String className,
                       java.lang.String methodName,
                       java.lang.String message)
If the log level is greater than or equal to WARNING, log the message.

Specified by:
logWarning in interface com.simba.support.ILogger
Parameters:
packageName - The package of the method attempting to log.
className - The name of the class to log.
methodName - The name of the method to log.
message - The message for the log.

prepareSettings

public void prepareSettings(java.lang.String fileName)
Sets up the logging with the appropriate settings.

Parameters:
fileName - The name of the file to log to. This name should not include the file path.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale for this logger.

Specified by:
setLocale in interface com.simba.support.ILogger
Parameters:
locale - The new locale.

setLogLevel

public void setLogLevel(com.simba.support.LogLevel logLevel)
Set the level of logging done by the ILogger.

Specified by:
setLogLevel in interface com.simba.support.ILogger
Parameters:
logLevel - The level of logging to write. Any logging below this level is ignored.

setLogPackage

public void setLogPackage(java.lang.String logPackage)
Enables/disables package-restricted logging.

Parameters:
logPackage - Package to restrict log to.


Copyright © 2006-2014 Simba Technologies Incorporated. All Rights Reserved.