<div class="gmail_quote">On Thu, May 24, 2012 at 9:01 AM, David Virdefors <span dir="ltr"><<a href="mailto:david.virdefors@purplescout.se" target="_blank">david.virdefors@purplescout.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div lang="SV" link="blue" vlink="purple"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I had a look at it. However it seemed to be outdated, and I really want to use the the existing ”Error Log” view. <u></u><u></u></span></p>

<p class="MsoNormal"><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:15px"><br></span></font></p></div></blockquote><div> </div><div><span style>I took a dive and figured it out. </span><div style>

<br><div>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:</div>

<div><br></div><div>OPTION 1: Manually add "Bundle-ClassPath" property to META-INF/Manifest.MF like so:</div></div><blockquote style><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">

Bundle-ClassPath: .,</blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"> libs/slf4j-api-1.6.4.jar,</blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">

 libs/logback-classic-1.0.3.jar,</blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"> libs/logback-core-1.0.3.jar</blockquote></div><div><br></div><div>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).</div>

</blockquote><div style><div><br></div><div>OPTION 2: Use the Eclipse GUI to edit MANIFEST.MF.</div><div><br></div></div><blockquote style><div>1. Double-click META-INF/MANIFEST.MF, which automatically opens a GUI presenter for the file's contents.</div>

<div>2. Click the "Runtime" tab in the presenter.</div><div>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).</div>

<div>4. Repeat step 3 for each external JAR.</div><div>5. Add the plugin's root directory to the classpath (click "New", and enter ".").</div><div>6. Sanity check: Click the "MANIFEST.MF" tab. Verify that the "Bundle-ClassPath" property contains the paths you just entered.</div>

</blockquote><div style><div><br></div><div>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:</div>

<div><br></div></div><blockquote style><div>1. From Eclipse, import the attached sample project (choose menu "File > Import... > Existing Projects into Workspace").</div><div>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.</div>

<div>3. Rebuild and run the project (which opens a new instance of Eclipse).</div><div>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.</div>

<div><br></div></blockquote></div></div>