Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.logging
Class Logger

java.lang.Object
  extended by 
org.eclipse.rse.logging.Logger
All Implemented Interfaces:
EventListener, Preferences.IPropertyChangeListener

public class Logger
extends Object
implements Preferences.IPropertyChangeListener

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());
//out.logDebugMessage(
// "myPlugin",
// "this is a debug message from class myPlugin.");
......
......
}


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


Field Summary
static boolean DEBUG
          Constant can be used to surround debugging code.
static int LOG_DEBUG
          Set debug_level to this value to get Debug messages.
static int LOG_ERROR
          Set debug_level to this value to get Error messages.
static int LOG_INFO
          Set debug_level to this value to get Information messages.
static int LOG_WARNING
          Set debug_level to this value to get Warning messages.
static  String LOGGING_LEVEL
          Name of the key that controls the logging level.
 
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 ( Preferences.PropertyChangeEvent event)
          Handle changes from a 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

DEBUG

public static final boolean DEBUG
Constant can be used to surround debugging code. Optimizing compilers have the possibility of removing the code from a production copy. Should be set false normally. Only set to true when testing.

See Also:
Constant Field Values

LOGGING_LEVEL

public static final 
String LOGGING_LEVEL
Name of the key that controls the logging level.
(value is "debug_level").

See Also:
Constant Field Values

LOG_ERROR

public static final int LOG_ERROR
Set debug_level to this value to get Error messages.
(value is 0).

See Also:
Constant Field Values

LOG_WARNING

public static final int LOG_WARNING
Set debug_level to this value to get Warning messages.
(value is 1).

See Also:
Constant Field Values

LOG_INFO

public static final int LOG_INFO
Set debug_level to this value to get Information messages.
(value is 2).

See Also:
Constant Field Values

LOG_DEBUG

public static final int LOG_DEBUG
Set debug_level to this value to get Debug messages.
(value is 3).

See Also:
Constant Field Values
Method Detail

freeResources

public void freeResources()

getDebugLevel

public int getDebugLevel()

logDebugMessage

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

and the output will be:

---------------------------------------------------------------
DEBUG org.eclipse.rse.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 locale.

Parameters:
message - the message to log.
ex - the exception that caused the condition, may be null.

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


propertyChange

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

Specified by:
propertyChange in interface Preferences.IPropertyChangeListener

setDebugLevel

public void setDebugLevel(int level)

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire