Java2OWL
Class Logging

Object
  extended by Logging

public class Logging
extends Object

This is an interface to Java's Logger system.

Each J2OManager gets its own logger, which can be individually configured. Log entries are submitted to the logger by one of the methods info, error etc. They are semantically classified and can be selectively turned on and off.


Constructor Summary
Logging(J2OManager manager)
          Creates a new logger for the J2OManager
 
Method Summary
 void activate(boolean active)
          activates/deactivates logging for all messages.
 void activate(Logging.Semantics... semantics)
          activates logging only for messages with the given semantics, and errors and warnings.
 void activateInfo(boolean active)
          globally activates/deactivates all info-messages, not the error-messages.
 void clear()
          clears the internal buffer or closes and reopens the file.
 void correlation(Logging.Semantics semantics, Object... objects)
          a correlation message.
 void entering(Object... objects)
          indicates entering a method and prints the objects.
 void error(String message, Logging.Origin origin, Object... objects)
          an error message.
 void event(Logging.Semantics semantics, Object... objects)
          an event message with a specific semantics.
 void exiting(Object... objects)
          indicates exiting a method and prints the objects.
 void finalize()
          flushes the messages and closes the handler
 void flush()
          flushes the messages to the output stream.
 String getContents()
          returns the loggings as string if the handler was set as "BUFFER".
 String getName()
          returns the name of the logger.
 boolean hasContents()
          returns true if the buffer is not empty .
 boolean hasErrors()
          returns true if errors have been logged.
 void info(Object... objects)
          any kind of unspecific info message.
 void installation(Object object)
          indicates installation of a module and prints the object.
 boolean isActive(Logging.Semantics semantics)
          checks whether logging for the messages with the given semantics is active.
 void resetFormatter()
          resets the formatter.
 void setFormatter(Formatter formatter)
          allows one to install a user defined formatter.
 void setHandler(Handler newHandler, boolean closable)
          allows one to install a user defined handler.
 void setHandler(Logging.Destination where, String filename)
          allows one to change the handler.
 void warning(String message, Logging.Origin origin, Object... objects)
          a warning.
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Logging

public Logging(J2OManager manager)
Creates a new logger for the J2OManager

Parameters:
manager - the top-level manager

The default handler is a stream handler which sends all messages to System.out All message classes are activated.

Method Detail

getName

public String getName()
returns the name of the logger.


setHandler

public void setHandler(Logging.Destination where,
                       String filename)
                throws IOException
allows one to change the handler.

Parameters:
where - either OUT, ERR of BUFFER or FILE.
filename - is a filename, if necessary.
Throws:
IOException - if the file could not be opened.

The handler sends the messages either to System,out, System.err, the given file or to the internal buffer.


setHandler

public void setHandler(Handler newHandler,
                       boolean closable)
allows one to install a user defined handler.

Parameters:
handler - the custom handler
closable - true if the handler must be closed at the end

The old handler is removed. The new handler gets the formatter of the previous handler.


getContents

public String getContents()
returns the loggings as string if the handler was set as "BUFFER".


hasContents

public boolean hasContents()
returns true if the buffer is not empty .


clear

public void clear()
clears the internal buffer or closes and reopens the file.


hasErrors

public boolean hasErrors()
returns true if errors have been logged.


setFormatter

public void setFormatter(Formatter formatter)
allows one to install a user defined formatter.


resetFormatter

public void resetFormatter()
resets the formatter.


isActive

public boolean isActive(Logging.Semantics semantics)
checks whether logging for the messages with the given semantics is active.


activate

public void activate(Logging.Semantics... semantics)
activates logging only for messages with the given semantics, and errors and warnings.


activate

public final void activate(boolean active)
activates/deactivates logging for all messages.


activateInfo

public void activateInfo(boolean active)
globally activates/deactivates all info-messages, not the error-messages.


flush

public void flush()
flushes the messages to the output stream.


entering

public void entering(Object... objects)
indicates entering a method and prints the objects.


exiting

public void exiting(Object... objects)
indicates exiting a method and prints the objects.


installation

public void installation(Object object)
indicates installation of a module and prints the object.


info

public void info(Object... objects)
any kind of unspecific info message.


error

public void error(String message,
                  Logging.Origin origin,
                  Object... objects)
an error message. In debugMode this method causes the system to stop.


event

public void event(Logging.Semantics semantics,
                  Object... objects)
an event message with a specific semantics.


warning

public void warning(String message,
                    Logging.Origin origin,
                    Object... objects)
a warning.


correlation

public void correlation(Logging.Semantics semantics,
                        Object... objects)
a correlation message.


finalize

public void finalize()
flushes the messages and closes the handler

Overrides:
finalize in class Object