Package weka.core
Class Debug.Log
java.lang.Object
weka.core.Debug.Log
- All Implemented Interfaces:
Serializable
,RevisionHandler
- Enclosing class:
- Debug
A helper class for logging stuff. Uses the java.util.logging
package. If this approach seems an "overkill" (it can create quite a few
log files if used in different threads), one can use the
Debug.SimpleLog class.
- Version:
- $Revision: 8034 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
ConstructorDescriptionLog()
default constructor, uses only stdoutcreates a logger that logs into the specified file, if null then only stdout is used.creates a logger that logs into the specified file, if null then only stdout is used. -
Method Summary
Modifier and TypeMethodDescriptionreturns the filename of the log, can be nullint
returns the number of files being usedReturns the revision string.int
getSize()
returns the size of the filesvoid
logs the given messagevoid
prints the given message with the specified levelvoid
prints the given message with the specified levelvoid
a convenience method for dumping the current system info in the log filestatic Level
stringToLevel
(String level) turns the string representing a level, e.g., "FINE" or "ALL" into the corresponding level (case-insensitive).toString()
returns a string representation of the logger
-
Constructor Details
-
Log
public Log()default constructor, uses only stdout -
Log
creates a logger that logs into the specified file, if null then only stdout is used. It uses 1,000,000 bytes for file size and 1 file.- Parameters:
filename
- the file to log into
-
Log
creates a logger that logs into the specified file, if null then only stdout is used.- Parameters:
filename
- the file to log intosize
- the size of the files in bytesnumFiles
- the number of files for rotating
-
-
Method Details
-
stringToLevel
turns the string representing a level, e.g., "FINE" or "ALL" into the corresponding level (case-insensitive). The default is ALL.- Parameters:
level
- the string to return a level for- Returns:
- the corresponding level or the default
-
getFilename
returns the filename of the log, can be null- Returns:
- the filename of the log
-
getSize
public int getSize()returns the size of the files- Returns:
- the size of a file
-
getNumFiles
public int getNumFiles()returns the number of files being used- Returns:
- the number of files
-
log
logs the given message- Parameters:
level
- the level of severitymessage
- the message to log
-
log
prints the given message with the specified level- Parameters:
level
- the level of loggingsourceclass
- the class that logs the messagemessage
- the message to print
-
log
prints the given message with the specified level- Parameters:
level
- the level of loggingsourceclass
- the class that logs the messagesourcemethod
- the method that logs the messagemessage
- the message to print
-
logSystemInfo
public void logSystemInfo()a convenience method for dumping the current system info in the log file- See Also:
-
toString
returns a string representation of the logger -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-