Package be.gaudry.model.system
Class BrolDump
java.lang.Object
be.gaudry.model.system.BrolDump
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBuilds a full report to dumpclear()
Clears all existing messages in memoryReturns the memory informations into a formated stringReturns the messages into a formated stringReturns the runtime informations into a formated stringReturns the system informations into a formated stringReturns the threads informations into a formated stringThe application name is needed to make different output files.The date format to use into the formated stringsReturns the default file path to the dump file for theapplication
.Returns the default file path to the logging file for theapplication
.Returns a localized message to inform that a dump is startedvoid
setAppName(String appName)
void
setDateFormat(DateFormat dateFormat)
void
Localize some strings using theLanguageHelper
features.void
start()
Starts dumpingvoid
Overrides content by dumping into the default filevoid
Writes the dump informations into a file.void
writeLog()
Appends content by writing into the default filevoid
Writes the logging informations into a file.
-
Field Details
-
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
Builds a BrolDump for a specific application- Parameters:
appName
- name of the application
-
-
Method Details
-
start
public void start()Starts dumping -
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
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
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
Clears all existing messages in memory- Returns:
- operation feedback
-
dumpMessages
Returns the messages into a formated string- Returns:
- the messages
-
dumpSystemInfo
Returns the system informations into a formated string- Returns:
- the system informations
-
dumpMemoryInfo
Returns the memory informations into a formated string- Returns:
- the memory informations
-
dumpRuntime
Returns the runtime informations into a formated string- Returns:
- the runtime informations
-
dumpTreads
Returns the threads informations into a formated string- Returns:
- the threads informations
-
getMessages
- Returns:
- the messages
-
getDateFormat
The date format to use into the formated strings- Returns:
- the dateFormat
-
setDateFormat
- Parameters:
dateFormat
- the dateFormat to set
-
getMsgDumpStr
Returns a localized message to inform that a dump is started- Returns:
- the msgDumpStr
-
getDefaultLogPath
Returns the default file path to the logging file for theapplication
.- Returns:
- the path to the log file
-
getDefaultDumpPath
Returns the default file path to the dump file for theapplication
.- Returns:
- the path to the dump file
-
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
- Parameters:
appName
- the application's name to set- See Also:
getAppName()
-
setLanguage
public void setLanguage()Localize some strings using theLanguageHelper
features. See thelogging information
to know how the logging is implemented.
-