Remote Systems
v6.4.1

com.ibm.etools.systems.logging
Class Logger

java.lang.Object
  extended bycom.ibm.etools.systems.logging.Logger

public class Logger
extends Object

Generic Logger class for handling Remote Systems logging and tracing.

The debug level is determined by a "debug_level" key in the preferences store of the plugin that owns this Logger instance.

The debug location is determined by a "log_location" key in the preferences store of the plugin that owns this Logger instance.

The valid values for these keys can be found in the javadocs for IRemoteSystemsLogging.
. This means that these keys could have been defined through hardcoding in your plugin startup code, through preferences.ini in the plugin install directory, OR from pref_store.ini in the plugin read/write metadata area.
The default behavior is to log to file, and to log only errors.
A typical usage of this class is as follows:

public class myPlugin extends AbstractUIPlugin {

// a cached Logger inst for convenience.
public static Logger out = null;

public myPlugin(IPluginDescriptor descriptor) {
super(descriptor);
......
......
out = LoggerFactory.getInst(this);
out.logInfo("loading myPlugin class.");
//out.logWarning("This is a warning message.");
//out.logError("This is an error.", new Exception());
//if (Logger.DEBUG)
// out.logDebugMessage(
// "myPlugin",
// "this is a debug message from class myPlugin.");
......
......
}


public void shutdown() throws CoreException {
super.shutdown();
LoggerFactory.freeInst(this);
}


Field Summary
static String Copyright
           
static boolean DEBUG
          This SHOULD be set to false in production.
 
Constructor Summary
protected Logger(AbstractUIPlugin systemPlugin)
           
 
Method Summary
 void freeResources()
           
 int getDebugLevel()
           
 void logDebugMessage(String className, String message)
          Log a Debug message.
 void logError(String message, Throwable ex)
          Log an Error message with an exception.
 void logInfo(String message)
          Log an Information message.
 void logInfo(String message, Throwable ex)
          Log an Information message.
 void logWarning(String message)
          Log a Warning message.
 void logWarning(String message, Throwable ex)
          Log a Warning message.
 void propertyChange(PropertyChangeEvent event)
          Handle changes from Preferences page.
 void setDebugLevel(int level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
This SHOULD be set to false in production.
Used to compile out developement debug messages.

See Also:
Constant Field Values
Constructor Detail

Logger

protected Logger(AbstractUIPlugin systemPlugin)
Method Detail

logDebugMessage

public void logDebugMessage(String className,
                            String message)
Log a Debug message. This is intended to be wrapped as follows:
if (Logger.DEBUG)
Logger.logDebugMessage("someClassName", "someMessage");

and the output will be:

---------------------------------------------------------------
DEBUG com.ibm.etools.systems.logging someClassName
someMessage
---------------------------------------------------------------


Note that since this message is only for developer debugging, it does not need to be localized to proper local.


logError

public void logError(String message,
                     Throwable ex)
Log an Error message with an exception. Note that the message should already be localized to proper local.
ie: Resource.getString() should already have been called


logInfo

public void logInfo(String message)
Log an Information message. Note that the message should already be localized to proper local.
ie: Resource.getString() should already have been called


logInfo

public void logInfo(String message,
                    Throwable ex)
Log an Information message. Note that the message should already be localized to proper local.
ie: Resource.getString() should already have been called


logWarning

public void logWarning(String message)
Log a Warning message. Note that the message should already be localized to proper local.
ie: Resource.getString() should already have been called


logWarning

public void logWarning(String message,
                       Throwable ex)
Log a Warning message. Note that the message should already be localized to proper local.
ie: Resource.getString() should already have been called


setDebugLevel

public void setDebugLevel(int level)

getDebugLevel

public int getDebugLevel()

freeResources

public void freeResources()

propertyChange

public void propertyChange(PropertyChangeEvent event)
Handle changes from Preferences page.


Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.