Package weka.core

# Class Debug.Log

java.lang.Object
weka.core.Debug.Log

All Implemented Interfaces:
  `Serializable`, `RevisionHandler`

Enclosing class:
  Debug

public static class Debug.Log extends Object implements Serializable, RevisionHandler
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:
  - `Debug.SimpleLog`
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Log()`
  default constructor, uses only stdout
  `Log(String filename)`
  creates a logger that logs into the specified file, if null then only stdout is used.
  `Log(String filename, int size, int numFiles)`
  creates a logger that logs into the specified file, if null then only stdout is used.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getFilename()`
  returns the filename of the log, can be null
  `int`
  `getNumFiles()`
  returns the number of files being used
  `String`
  `getRevision()`
  Returns the revision string.
  `int`
  `getSize()`
  returns the size of the files
  `void`
  `log(Level level, String message)`
  logs the given message
  `void`
  `log(Level level, String sourceclass, String message)`
  prints the given message with the specified level
  `void`
  `log(Level level, String sourceclass, String sourcemethod, String message)`
  prints the given message with the specified level
  `void`
  `logSystemInfo()`
  a convenience method for dumping the current system info in the log file
  `static Level`
  `stringToLevel(String level)`
  turns the string representing a level, e.g., "FINE" or "ALL" into the corresponding level (case-insensitive).
  `String`
  `toString()`
  returns a string representation of the logger

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Log

    public Log()
    default constructor, uses only stdout

  - ### Log

    public Log(String filename)
    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

    public Log(String filename, int size, int numFiles)
    creates a logger that logs into the specified file, if null then only stdout is used.
    Parameters:
      `filename` - the file to log into
      `size` - the size of the files in bytes
      `numFiles` - the number of files for rotating

- ## Method Details

  - ### stringToLevel

    public static Level stringToLevel(String level)
    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

    public String 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

    public void log(Level level, String message)
    logs the given message
    Parameters:
      `level` - the level of severity
      `message` - the message to log

  - ### log

    public void log(Level level, String sourceclass, String message)
    prints the given message with the specified level
    Parameters:
      `level` - the level of logging
      `sourceclass` - the class that logs the message
      `message` - the message to print

  - ### log

    public void log(Level level, String sourceclass, String sourcemethod, String message)
    prints the given message with the specified level
    Parameters:
      `level` - the level of logging
      `sourceclass` - the class that logs the message
      `sourcemethod` - the method that logs the message
      `message` - the message to print

  - ### logSystemInfo

    public void logSystemInfo()
    a convenience method for dumping the current system info in the log file
    See Also:
      - `SystemInfo`

  - ### toString

    public String toString()
    returns a string representation of the logger
    Overrides:
      `toString` in class `Object`
    Returns:
      a string representation of the logger

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Returns:
      the revision