Reputation: 513
From Eclipse experts I want to know whether it is good to use log framework org.eclipse.e4.core.services.log.Logger
provided by Eclipse RCP in RCP based products or shall we use logback in Eclipse RCP? I am using Eclipse E4 for developing. The problem I see with Eclipse logger is it gives warning "Discouraged access: The type 'Logger' is not API". Which one is preferred way of logging in Eclipse RCP development?
Upvotes: 2
Views: 465
Reputation: 4958
As @greg-449's answer says, using the org.eclipse.e4.core.services.log.Logger
is fine, and the warning can be safely ignored.
For those like me who'd prefer to keep their code free of pesky warnings that shouldn't be warnings, here's how to disable this particular one (same goes for others where you're sure you can safely ignore them).
1) Configure access rules
You can get there either directly from the tooltip shown when hovering over the "Discouraged access" warning...
... or via your Project properties
> Java Build Path
> Libraries
> Plug-in Dependencies
2) Edit the access rules
In the list of plug-in dependencies, find the one that you want to override - in this case, it's the org.eclipse.e4.core.services[version].jar
, expand it, click on its access rules, and then on the "Edit..." button on the right.
3) Add a new rule
Hit the "Add..." button on the right to open the "Add Access Rule" dialog, and add a rule to make org/eclipse/e4/core/services/log/Logger
accessible without warnings:
Hit OK to close the dialog.
4) Move the new rule up
The rules are processed top-down until a matching rule is found, so we want the new "Accessible" one to fire before the original "Discouraged" rule. Use the "Up" button to move the new rule, well, up. It should look like this:
Accept all the dialogs, and the warnings should be gone.
Upvotes: 1
Reputation: 111142
Logger
is OK despite the discouraged access warning. There are still a number of e4 APIs which have not been completely finalized and these have this warning.
You may also find StatusReporter
useful. This can do logging and show error dialogs.
Upvotes: 3