org.openptk.logging
Class SimpleLogger

java.lang.Object
  extended by org.openptk.logging.SimpleLogger
All Implemented Interfaces:
LoggingIF

public class SimpleLogger
extends java.lang.Object


Field Summary
protected static java.util.logging.Logger _logger
           
 
Fields inherited from interface org.openptk.logging.LoggingIF
PROP_CLASSNAME, PROP_FILENAME
 
Constructor Summary
SimpleLogger(java.lang.String file)
          SimpleLogger - Create a new simple logger with a file to be written to.
 
Method Summary
 void addConsole()
           
 void addFile(java.lang.String file)
           
 void close()
           
 void finialize()
           
 java.lang.String getId()
          Returns the ID/Name of the logging facility
 void log(java.lang.String msg)
          Prints the message to logger as an INFO level message.
 void logError(java.lang.String msg)
          Prints the message to logger as an ERROR level message.
 void logInfo(java.lang.String msg)
          Prints the message to logger as an INFO level message.
 void logWarning(java.lang.String msg)
          Prints the message to logger as an WARNING level message.
 void put(LoggingLevel type, java.lang.String msg)
          Prints the message to logger using the LoggingLevel type passed.
 void put(java.lang.String msg)
          Prints the message to standard output using the INFO.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected static final java.util.logging.Logger _logger
Constructor Detail

SimpleLogger

public SimpleLogger(java.lang.String file)
SimpleLogger - Create a new simple logger with a file to be written to. This Logger is based on the OpenPTK JavaLogger which is based on the java.util.logging.Logger facility. Note that only 1 SimpleLogger should be used within a JVM. There are no real advantages to using multiple JavaLogger child classes as they are based on the Java Logging facility which is a singleton with a single global logger.

Parameters:
file - to write all messages to
Method Detail

addConsole

public void addConsole()
Specified by:
addConsole in interface LoggingIF

addFile

public void addFile(java.lang.String file)
             throws java.lang.Exception
Specified by:
addFile in interface LoggingIF
Parameters:
file -
Throws:
java.lang.Exception

close

public void close()
Specified by:
close in interface LoggingIF

finialize

public void finialize()
               throws java.lang.Throwable
Throws:
java.lang.Throwable

getId

public java.lang.String getId()
Returns the ID/Name of the logging facility

Specified by:
getId in interface LoggingIF
Returns:
name

log

public void log(java.lang.String msg)
Prints the message to logger as an INFO level message.

Specified by:
log in interface LoggingIF
Parameters:
msg - String to be printed to logger.

logError

public void logError(java.lang.String msg)
Prints the message to logger as an ERROR level message.

Specified by:
logError in interface LoggingIF
Parameters:
msg - String to be printed to logger.

logInfo

public void logInfo(java.lang.String msg)
Prints the message to logger as an INFO level message.

Specified by:
logInfo in interface LoggingIF
Parameters:
msg - String to be printed to logger.

logWarning

public void logWarning(java.lang.String msg)
Prints the message to logger as an WARNING level message.

Specified by:
logWarning in interface LoggingIF
Parameters:
msg - String to be printed to logger.

put

public void put(LoggingLevel type,
                java.lang.String msg)
Prints the message to logger using the LoggingLevel type passed.

Specified by:
put in interface LoggingIF
Parameters:
type - LoggingLevel to log the message as
msg - String to be printed to logger.

put

public void put(java.lang.String msg)
Prints the message to standard output using the INFO.

Specified by:
put in interface LoggingIF
Parameters:
msg - String to be printed to logger.


View/submit a bug or feature

For further API reference and developer documentation, see www.openptk.org. That documentation contains more detailed, developer-targeted descriptions, definitions of terms, workarounds, and working code examples.

Copyright (C) 2008-2012, Project OpenPTK. All Rights Reserved