Class ErrorLogger

java.lang.Object
armyc2.c5isr.renderer.utilities.ErrorLogger

public class ErrorLogger extends Object
Error Logging class for Renderer
  • Field Details

  • Constructor Details

  • Method Details

    • getLoggingStatus

      public static Boolean getLoggingStatus()
      True if logging is enabled
      Returns:
    • getStackTrace

      public static String getStackTrace(Throwable thrown)
      Takes a throwable and puts it's stacktrace into a string.
      Parameters:
      thrown -
      Returns:
    • EnableLogging

      public static void EnableLogging(Boolean enable)
      TRUE: Creates a file handler that will log message to a file. FALSE: logging just goes to console.
      Parameters:
      enable -
    • setLoggingPath

      public static void setLoggingPath(String path)
      Folder location to store the log file. Defaults to "System.getProperty("user.dir")"
      Parameters:
      path -
    • CleanupOldFiles

      public static void CleanupOldFiles(int DaysOld)
      clears log files that are beyond a passed number of days old
      Parameters:
      DaysOld -
    • setLevel

      public static void setLevel(Level newLevel)
      Set minimum level at which an item can be logged. In descending order: Severe Warning Info Config Fine Finer Finest
      Parameters:
      newLevel -
    • setLevel

      public static void setLevel(Level newLevel, Boolean setConsoleHandler)
      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

      public static void setUseParentHandlers(boolean useParentHandlers)
      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

      public static Level getLevel()
      Gets the java.util.logging.Level that the logger is set to.
      Returns:
    • Entering

      public static void Entering(String sourceClass, String sourceMethod)
      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 request
      sourceMethod - name of method that is being entered
    • Entering

      public static void Entering(String sourceClass, String sourceMethod, Object param1)
      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 request
      sourceMethod - name of method that is being entered
      param1 - parameter to the method being entered
    • Entering

      public static void Entering(String sourceClass, String sourceMethod, Object[] params)
      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 request
      sourceMethod - name of method that is being entered
      params - array of parameters to the method being entered
    • Exiting

      public static void Exiting(String sourceClass, String sourceMethod)
      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 request
      sourceMethod - name of the method
    • Exiting

      public static void Exiting(String sourceClass, String sourceMethod, Object result)
      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 request
      sourceMethod - name of the method
      result - Object that is being returned
    • LogMessage

      public static void LogMessage(String message)
      Defaults to Level.INFO
      Parameters:
      message -
    • LogMessage

      public static void LogMessage(String message, Boolean showMessageBox)
      Defaults to Level.INFO
      Parameters:
      message -
      showMessageBox -
    • LogMessage

      public static void LogMessage(String message, Level lvl, Boolean showMessageBox)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message, Boolean showMessageBox)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message, Level lvl)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message, Level lvl, Boolean showMessageBox)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message, Level lvl, Object param1, Boolean showMessageBox)
    • LogMessage

      public static void LogMessage(String sourceClass, String sourceMethod, String message, Level lvl, Object[] params, Boolean showMessageBox)
    • LogException

      public static void LogException(String sourceClass, String sourceMethod, Exception exc)
    • LogException

      public static void LogException(String sourceClass, String sourceMethod, Exception exc, Boolean showMessageBox)
    • LogException

      public static void LogException(String sourceClass, String sourceMethod, Exception exc, Level lvl)
    • LogException

      public static void LogException(String sourceClass, String sourceMethod, Exception exc, Level lvl, Boolean showMessageBox)