[logback-user] RCP

Tony Trinh tony19 at gmail.com
Thu May 24 17:25:32 CEST 2012


On Thu, May 24, 2012 at 9:01 AM, David Virdefors <
david.virdefors at purplescout.se> wrote:

> Hi,****
>
> ** **
>
> I had a look at it. However it seemed to be outdated, and I really want to
> use the the existing ”Error Log” view. ****
>
>
>
I took a dive and figured it out.

The first step is to add the external JARs to your project. I created a
"libs" directory under my Eclipse plugin project, and symlinked the JARs
there. Then I specified these project JARs with the "Bundle-ClassPath"
property in the plugin's manifest. You can edit this classpath a couple
ways:

OPTION 1: Manually add "Bundle-ClassPath" property to META-INF/Manifest.MF
like so:


Bundle-ClassPath: .,

 libs/slf4j-api-1.6.4.jar,

 libs/logback-classic-1.0.3.jar,

 libs/logback-core-1.0.3.jar


Add any other external JARs to this list if necessary. Note the first path
is "." to tell the plugin to include its root directory in its classpath
(it's not smart enough to assume that).


OPTION 2: Use the Eclipse GUI to edit MANIFEST.MF.

1. Double-click META-INF/MANIFEST.MF, which automatically opens a GUI
presenter for the file's contents.
2. Click the "Runtime" tab in the presenter.
3. In the "Classpath" section, click "New". In the prompt that opens, enter
the relative path to the external JAR (e.g., libs/logback-core-1.0.3.jar).
4. Repeat step 3 for each external JAR.
5. Add the plugin's root directory to the classpath (click "New", and enter
".").
6. Sanity check: Click the "MANIFEST.MF" tab. Verify that the
"Bundle-ClassPath" property contains the paths you just entered.


See the attached sample project with this all working. I created the
EclipseLogAppender class, which writes to Eclipse's Error Log. (It would be
nice to add this class to logback's source, but it's dependent on Eclipse
packages...not sure how to handle that.) To run the example:

1. From Eclipse, import the attached sample project (choose menu "File >
Import... > Existing Projects into Workspace").
2. Download logback-core-1.0.3.jar, logback-classic-1.0.3.jar, and
slf4j-api-1.6.4.jar into the project's "libs" directory.
3. Rebuild and run the project (which opens a new instance of Eclipse).
4. From the new instance of Eclipse, open the Error Log (menu "Window >
Show Views > Error Log"), and choose menu "Sample Menu > Sample Command".
This causes a "Hello World" message box, followed by a log entry in the
Error Log.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120524/98875b2d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EclipseLogAppender-example.tgz
Type: application/x-gzip
Size: 4753 bytes
Desc: not available
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120524/98875b2d/attachment.bin>


More information about the Logback-user mailing list