Class BrolDump

java.lang.Object
be.gaudry.model.system.BrolDump

public class BrolDump extends Object
When an application is terminated normally, the application first starts any registered shutdown threads, waits for them to complete and then finally exits.Normal termination can be caused by a call to System.exit(), the completion of the last non-daemon thread, or the interruption of the application (control-C) by the user. Abnormal termination (which does not cause the shutdown threads to be started) is caused some major fault in the Java virtual machine or native library. So if you want to get a memory report just before your application end (normal ending or Exception thrown ie. : OutOfMemoryException) you can add a shutdown thread to your runtime environment which display the report. Provided by the broldev.core.model project.
Since:
1.0 Sep 11, 2009, broldev.core.model 0.0.1-SNAPSHOT dependency
Version:
1.0 Sep 11, 2009
Author:
Steph GAUDRY
  • Field Details

    • LINE_BORDER

      public static final String LINE_BORDER
      Line separator to enhance readability of the log
      See Also:
      Constant Field Values
  • Constructor Details

    • BrolDump

      public BrolDump()
      Builds a default BrolDump
    • BrolDump

      public BrolDump(String appName)
      Builds a BrolDump for a specific application
      Parameters:
      appName - name of the application
  • Method Details

    • start

      public void start()
      Starts dumping
    • buildFullReport

      public String buildFullReport()
      Builds a full report to dump
      Returns:
      string with all the informations
    • writeLog

      public void writeLog()
      Appends content by writing into the default file
    • writeDump

      public void writeDump()
      Overrides content by dumping into the default file
    • writeDump

      public void writeDump(File file, boolean append)
      Writes the dump informations into a file.
      Parameters:
      file - where to dump (null to use default file)
      append - true to append information, otherwise overrides the existing.
    • writeLog

      public void writeLog(File file, boolean append)
      Writes the logging informations into a file.
      Parameters:
      file - where to log (null to use default file)
      append - true to append information, otherwise overrides the existing.
    • clear

      public String clear()
      Clears all existing messages in memory
      Returns:
      operation feedback
    • dumpMessages

      public String dumpMessages()
      Returns the messages into a formated string
      Returns:
      the messages
    • dumpSystemInfo

      public String dumpSystemInfo()
      Returns the system informations into a formated string
      Returns:
      the system informations
    • dumpMemoryInfo

      public String dumpMemoryInfo()
      Returns the memory informations into a formated string
      Returns:
      the memory informations
    • dumpRuntime

      public String dumpRuntime()
      Returns the runtime informations into a formated string
      Returns:
      the runtime informations
    • dumpTreads

      public String dumpTreads()
      Returns the threads informations into a formated string
      Returns:
      the threads informations
    • getMessages

      public Stack<String> getMessages()
      Returns:
      the messages
    • getDateFormat

      public DateFormat getDateFormat()
      The date format to use into the formated strings
      Returns:
      the dateFormat
    • setDateFormat

      public void setDateFormat(DateFormat dateFormat)
      Parameters:
      dateFormat - the dateFormat to set
    • getMsgDumpStr

      public String getMsgDumpStr()
      Returns a localized message to inform that a dump is started
      Returns:
      the msgDumpStr
    • getDefaultLogPath

      public String getDefaultLogPath()
      Returns the default file path to the logging file for the application.
      Returns:
      the path to the log file
    • getDefaultDumpPath

      public String getDefaultDumpPath()
      Returns the default file path to the dump file for the application.
      Returns:
      the path to the dump file
    • getAppName

      public String getAppName()
      The application name is needed to make different output files. If not set, the default name of the Broldev applications is used, and all applications dumps into the same file.
      Returns:
      the name of the application
    • setAppName

      public void setAppName(String appName)
      Parameters:
      appName - the application's name to set
      See Also:
      getAppName()
    • setLanguage

      public void setLanguage()
      Localize some strings using the LanguageHelper features. See the logging information to know how the logging is implemented.