Skip to content
dschadow edited this page Dec 23, 2014 · 2 revisions

To make logging for developers as easy as possible and to provide a single log file for the users we created the org.jcryptool.core.logging plug-in. This plug-in takes care of writing a single log file in the users' workspace which can be shown in the Error Log view. The user can select the log level via a preference page. Only messages with the selected error level or higher will be logged. This setting does not work as a filter for the error log view but for the log itself. The default log level is error.

The only thing to do for a developer is to call on of the LogUtil methods and log the message. There is no need to ask for the current log level since the Logging plug-in decides which log messages are logged and which are not.

To activate logging for a plug-in simply open its MANIFEST.MF file and add the package org.jcryptool.core.logging.utils to the Required Bundles section. After that you can easily call any of the methods provided in the LogUtil class like:

LogUtil.logError(bundleId, message, exception);

Since this is a technical error message only and not intended for the user directly only write English messages to the log and do not internationalize them. This message is only used for logging and should make bugfixing easier. It is not intended to replace a user friendly error message (in a dialog or something similar).

One exception of that is the logError method with four parameters:

LogUtil.logError(bundleId, message, exception, true);

In this case the last parameter determines, whether or not the user will see an error dialog together with the logging of the message. Using this method, all parameters must be given. Since the error message now will be shown in the log and in the dialog, it must be internationalized! Please use a language understandable by normal users, and provide suggestions on how to avoid this error (if available). We do recommend using this method to show identical error dialogs all over JCrypTool.