Breadcrumb
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
catch
block. -
Log an
IStatus
object with thelog(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:
-
INFO
is the global default setting in the logging service for Sabre Red 360.INFO
captures important messages in the log file. -
WARNING
captures Sabre Red 360 and plug-in errors from which end-users can recover. The types of problem that are logged withWARNING
do not prevent end-users from using Sabre Red 360. -
SEVERE
captures 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.
-
FINEST
,FINE
, andCONFIG
- 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 FINEST
, FINE
, and CONFIG
levels can capture the statements that the program enters in order to identify problems.
Logging levels are defined in com.sabre.edge.platform.core.logging.types.Level
.
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 INFO
.
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
-
org.eclipse.ui
-
org.eclipse.core.runtime
-
com.sabre.edge.platform.core.logging
-
com.sabre.edge.platform.core.common. This is required when Activator extends AbstractEdgeBasePlugin.
Extension Points
Not applicable
Classes
-
Activator class
-
Extend com.sabre.edge.platform.core.common.AbstractEdgeBasePlugin.
-
ILoggerService
-
Any of the logging methods that this book describes.