org.eclipse.datatools.modelbase.sql.query.util
Class SQLLogUtil

java.lang.Object
  extended byorg.eclipse.datatools.modelbase.sql.query.util.SQLLogUtil
Direct Known Subclasses:
SQLQueryLogger

public class SQLLogUtil
extends java.lang.Object

This class provides the logging and tracing facility using Eclipse standard logging machanism.


Constructor Summary
SQLLogUtil(Plugin plugin)
           
 
Method Summary
 Plugin getCurrentPlugin()
           
 boolean isTracing()
          Gets whether or not tracing is active.
 void setCurrentPlugin(Plugin currentPlugin)
           
 void write(java.lang.Object obj)
          Logs an error described by an object.
 void write(java.lang.String text)
          Logs an error described by a text.
 void write(java.lang.Throwable throwable)
          Logs an error described by a throwable.
 void writeInfo(java.lang.String text)
          Logs an information described by a text.
 void writeLog(java.lang.Object obj)
          Logs an error described by an object.
 void writeLog(java.lang.String text)
          Logs an error described by a text.
 void writeLog(java.lang.Throwable throwable)
          Logs an error described by a throwable.
 void writeTrace(java.lang.String text)
          Traces the given string.
 void writeTraceEntry(java.lang.Object[] args)
          Traces a method entry and optionally the method's arguments.
 boolean writeTraceExit(boolean returnValue)
          Traces a method exit and optionally the method's return value.
 int writeTraceExit(int returnValue)
          Traces a method exit and optionally the method's return value.
 java.lang.Object writeTraceExit(java.lang.Object returnValue)
          Traces a method exit and optionally the method's return value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLLogUtil

public SQLLogUtil(Plugin plugin)
Method Detail

getCurrentPlugin

public Plugin getCurrentPlugin()
Returns:
Returns the currentPlugin.

setCurrentPlugin

public void setCurrentPlugin(Plugin currentPlugin)
Parameters:
currentPlugin - The currentPlugin to set.

isTracing

public boolean isTracing()
Gets whether or not tracing is active. This method can be used to improve performance by "guarding" trace calls that do something expensive, such as creating objects. For example: if (getPlugin().getLogUtil().isTracing()) { getPlugin().getLogUtil().writeTraceEntry( new Object[] {new Integer( intval )} ); }

Returns:
true when tracing is active, otherwise false

write

public void write(java.lang.Throwable throwable)
Logs an error described by a throwable.

This method should be used whenever a class in this plugin has to log an error since it adheres to the global logging strategy.

Parameters:
throwable -

write

public void write(java.lang.String text)
Logs an error described by a text.

This method should be whenever a class in this plugin has to log an error since it adheres to the global logging strategy.

Parameters:
text -

write

public void write(java.lang.Object obj)
Logs an error described by an object.

This method should be whenever a class in this plugin has to log an error since it adheres to the global logging strategy.

Parameters:
obj -

writeInfo

public void writeInfo(java.lang.String text)
Logs an information described by a text.

This method should be whenever a class in this plugin has to log an information since it adheres to the global logging strategy.

Parameters:
text -

writeLog

public void writeLog(java.lang.Throwable throwable)
Logs an error described by a throwable.

This method should be used whenever a class in this plugin has to log an error since it adheres to the global logging strategy.

Parameters:
throwable -

writeLog

public void writeLog(java.lang.String text)
Logs an error described by a text.

This method should be whenever a class in this plugin has to log an error since it adheres to the global logging strategy.

Parameters:
text -

writeLog

public void writeLog(java.lang.Object obj)
Logs an error described by an object.

This method should be whenever a class in this plugin has to log an error since it adheres to the global logging strategy.


writeTrace

public void writeTrace(java.lang.String text)
Traces the given string.

This method is used to trace intermediate results in a method. The calls writeTraceEntry and writeTraceExit can be used to provide context for this trace entry.

Parameters:
text - the text to write to the trace log

writeTraceEntry

public void writeTraceEntry(java.lang.Object[] args)
Traces a method entry and optionally the method's arguments.

This method should be used to log the control flow in this plugin since it adheres to the global logging strategy.

Parameters:
args - optional Object[] the arguments for the method invokation, Note: args[i].toString() will be called to create the trace message

writeTraceExit

public boolean writeTraceExit(boolean returnValue)
Traces a method exit and optionally the method's return value.

This method should be used to log the control flow in this plugin since it adheres to the global logging strategy.

Parameters:
returnValue - the return value of the method to be traced,
Returns:
the given returnValue

writeTraceExit

public int writeTraceExit(int returnValue)
Traces a method exit and optionally the method's return value.

This method should be used to log the control flow in this plugin since it adheres to the global logging strategy.

Parameters:
returnValue - the return value of the method to be traced,
Returns:
the given returnValue

writeTraceExit

public java.lang.Object writeTraceExit(java.lang.Object returnValue)
Traces a method exit and optionally the method's return value.

This method should be used to log the control flow in this plugin since it adheres to the global logging strategy.

Parameters:
returnValue - optional the return value of the method to be traced, Note: returnValue.toString() will be called to create the trace message
Returns:
the given returnValue


Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.