Class ErrorLogger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
CleanupOldFiles
(int DaysOld) clears log files that are beyond a passed number of days oldstatic void
EnableLogging
(Boolean enable) TRUE: Creates a file handler that will log message to a file.static void
Log a method entry.static void
Log a method entry, with one parameter.static void
Log a method entry, with an array of parameters.static void
Log a method return.static void
Log a method return, with result object.static Level
getLevel()
Gets the java.util.logging.Level that the logger is set to.static Boolean
True if logging is enabledstatic String
getStackTrace
(Throwable thrown) Takes a throwable and puts it's stacktrace into a string.static void
LogException
(String sourceClass, String sourceMethod, Exception exc) static void
LogException
(String sourceClass, String sourceMethod, Exception exc, Boolean showMessageBox) static void
LogException
(String sourceClass, String sourceMethod, Exception exc, Level lvl) static void
LogException
(String sourceClass, String sourceMethod, Exception exc, Level lvl, Boolean showMessageBox) static void
LogMessage
(String message) Defaults to Level.INFOstatic void
LogMessage
(String message, Boolean showMessageBox) Defaults to Level.INFOstatic void
LogMessage
(String sourceClass, String sourceMethod, String message) static void
LogMessage
(String sourceClass, String sourceMethod, String message, Boolean showMessageBox) static void
LogMessage
(String sourceClass, String sourceMethod, String message, Level lvl) static void
LogMessage
(String sourceClass, String sourceMethod, String message, Level lvl, Boolean showMessageBox) static void
LogMessage
(String sourceClass, String sourceMethod, String message, Level lvl, Object[] params, Boolean showMessageBox) static void
LogMessage
(String sourceClass, String sourceMethod, String message, Level lvl, Object param1, Boolean showMessageBox) static void
LogMessage
(String message, Level lvl, Boolean showMessageBox) static void
Set minimum level at which an item can be logged.static void
Set minimum level at which an item can be logged.static void
setLoggingPath
(String path) Folder location to store the log file.static void
setUseParentHandlers
(boolean useParentHandlers) Specify whether or not this logger should send its output to it's parent Logger.
-
Field Details
-
LoggerName
- See Also:
-
-
Constructor Details
-
ErrorLogger
public ErrorLogger()
-
-
Method Details
-
getLoggingStatus
True if logging is enabled- Returns:
-
getStackTrace
Takes a throwable and puts it's stacktrace into a string.- Parameters:
thrown
-- Returns:
-
EnableLogging
TRUE: Creates a file handler that will log message to a file. FALSE: logging just goes to console.- Parameters:
enable
-
-
setLoggingPath
Folder location to store the log file. Defaults to "System.getProperty("user.dir")"- Parameters:
path
-
-
CleanupOldFiles
clears log files that are beyond a passed number of days old- Parameters:
DaysOld
-
-
setLevel
Set minimum level at which an item can be logged. In descending order: Severe Warning Info Config Fine Finer Finest- Parameters:
newLevel
-
-
setLevel
Set minimum level at which an item can be logged. In descending order: Severe Warning Info Config Fine Finer Finest- Parameters:
newLevel
-setConsoleHandler
- logger could be set to FINE but the console handler could be set to INFO. In that case, anything logged at FINE wouldn't show because it'd get blocked by the console handler. Set to "true" to make sure the console handler will let you log at the level you want. If you're only concerned with the log file, you can leave "false"
-
setUseParentHandlers
Specify whether or not this logger should send its output to it's parent Logger. This means that any LogRecords will also be written to the parent's Handlers, and potentially to its parent, recursively up the namespace. Defaults to true;- Parameters:
useParentHandlers
- true if output is to be sent to the logger's parent.- Throws:
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission("control").
-
getLevel
Gets the java.util.logging.Level that the logger is set to.- Returns:
-
Entering
Log a method entry.This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY", log level FINER, and the given sourceMethod and sourceClass is logged.
- Parameters:
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that is being entered
-
Entering
Log a method entry, with one parameter.This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY {0}", log level FINER, and the given sourceMethod, sourceClass, and parameter is logged.
- Parameters:
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that is being enteredparam1
- parameter to the method being entered
-
Entering
Log a method entry, with an array of parameters.This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY" (followed by a format {N} indicator for each entry in the parameter array), log level FINER, and the given sourceMethod, sourceClass, and parameters is logged.
- Parameters:
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that is being enteredparams
- array of parameters to the method being entered
-
Exiting
Log a method return.This is a convenience method that can be used to log returning from a method. A LogRecord with message "RETURN", log level FINER, and the given sourceMethod and sourceClass is logged.
- Parameters:
sourceClass
- name of class that issued the logging requestsourceMethod
- name of the method
-
Exiting
Log a method return, with result object.This is a convenience method that can be used to log returning from a method. A LogRecord with message "RETURN {0}", log level FINER, and the gives sourceMethod, sourceClass, and result object is logged.
- Parameters:
sourceClass
- name of class that issued the logging requestsourceMethod
- name of the methodresult
- Object that is being returned
-
LogMessage
Defaults to Level.INFO- Parameters:
message
-
-
LogMessage
Defaults to Level.INFO- Parameters:
message
-showMessageBox
-
-
LogMessage
-
LogMessage
-
LogMessage
public static void LogMessage(String sourceClass, String sourceMethod, String message, Boolean showMessageBox) -
LogMessage
-
LogMessage
-
LogMessage
-
LogMessage
-
LogException
-
LogException
public static void LogException(String sourceClass, String sourceMethod, Exception exc, Boolean showMessageBox) -
LogException
-
LogException
-