About Logger Services
The Logger Service class provides logging services for a plug-in. This class can do the following:
Capture a message in a log file.
Capture a message that is combined with an exception in a log file. This is useful to log an unexpected event from the
IStatusobject with the
log(String msg, IStatus status)method in this class.
IStatus is an interface in the Eclipse framework. The
IStatus interface passes the outcome of an operation. Its object contains such details as the plug-in identifier, the severity, the status code, the message, and the exception. For more information about
IStatus, consult the Eclipse documentation.
You can combine any of these logging capabilities in your plug-in.
The following describes the log levels and their common use in Sabre Red 360 by developers:
INFOis the global default setting in the logging service for Sabre Red 360.
INFOcaptures important messages in the log file.
WARNINGcaptures Sabre Red 360 and plug-in errors from which end-users can recover. The types of problem that are logged with
WARNINGdo not prevent end-users from using Sabre Red 360.
SEVEREcaptures serious errors that either crash the plug-in or Sabre Red 360.
For example, suppose that your plug-in connects to a database to extract data. You can use the
INFO level to indicate that the data was extracted without any problems. If the connection to the database fails, you use the
WARNING level to capture the error.
CONFIG- These levels capture messages that usually are not captured in log files, however, capturing them may help debugging a problem.
For example, assume that your plug-in has complicated source code with nested if statements. The
CONFIG levels can capture the statements that the program enters in order to identify problems.
Logging levels are defined in
The current implementation of Sabre Red 360 does not support the ability of developers to change log levels. The Sabre Red 360 administrator can set a level other than
INFO for specific end-users in order to debug or diagnose problems.
Caution! Sabre Red 360 drops messages with log levels that are set lower than
Dependencies and Classes
Whether you are customizing Logger Service or creating the sample service that the procedure in this book builds, both Eclipse and Sabre Red 360 have defined some dependencies, extension points, and classes that are required to add Logger Service to a plug-in. They are listed below.
Minimum Required Dependencies
com.sabre.edge.platform.core.common. This is required when Activator extends AbstractEdgeBasePlugin.
Any of the logging methods that this book describes.