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: 7519 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLog()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 nullintreturns the number of files being usedReturns the revision string.intgetSize()returns the size of the filesvoidlogs the given messagevoidprints the given message with the specified levelvoidprints the given message with the specified levelvoida convenience method for dumping the current system info in the log filestatic LevelstringToLevel(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
-
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
-
log
-
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
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-