
On Thu, May 24, 2012 at 9:01 AM, David Virdefors < david.virdefors@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.

On Thu, May 24, 2012 at 11:25 AM, Tony Trinh <tony19@gmail.com> wrote:
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.
I updated EclipseLogAppender to decouple it from the plugin; it now
requires the plugin bundle's symbolic name (as specified in the "Bundle-SymbolicName" property in the plugin's manifest), which is set in the logback config as seen below: <configuration> <appender name="eclipse" class="ch.qos.logback.classic.EclipseLogAppender"> <encoder> <pattern>[%method] > %msg%n</pattern> </encoder> <bundleName>com.example.e4.helloworld</bundleName> </appender> <root level="TRACE"> <appender-ref ref="eclipse" /> </root> </configuration>

Hi Tony, Nice work! Do you have suggestions as how to package this code? Should be it be a Eclipse plugin? (I am assuming it can be anything else). -- Ceki http://twitter.com/#!/ceki On 24.05.2012 18:27, Tony Trinh wrote:
On Thu, May 24, 2012 at 11:25 AM, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
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.
I updated EclipseLogAppender to decouple it from the plugin; it now requires the plugin bundle's symbolic name (as specified in the "Bundle-SymbolicName" property in the plugin's manifest), which is set in the logback config as seen below:
<configuration> <appender name="eclipse" class="ch.qos.logback.classic.EclipseLogAppender"> <encoder> <pattern>[%method] > %msg%n</pattern> </encoder> <bundleName>com.example.e4.helloworld</bundleName> </appender>
<root level="TRACE"> <appender-ref ref="eclipse" /> </root> </configuration>

Thanks, Ceki. I'm thinking we can put EclipseLogAppender.java in logback-extensions [1] and package it as a JAR that users could add to their Eclipse projects. Separating it from the main logback source makes sense to me especially because it depends on a couple Eclipse packages. A link to it from the logback.qos.ch (or the documentation therein) might be helpful for users to find it. Thoughts? [1]: https://github.com/qos-ch/logback-extensions On Thu, May 24, 2012 at 12:34 PM, ceki <ceki@qos.ch> wrote:
Hi Tony,
Nice work! Do you have suggestions as how to package this code? Should be it be a Eclipse plugin? (I am assuming it can be anything else).
-- Ceki http://twitter.com/#!/ceki
On 24.05.2012 18:27, Tony Trinh wrote:
On Thu, May 24, 2012 at 11:25 AM, Tony Trinh <tony19@gmail.com <mailto:tony19@gmail.com>> wrote:
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.
I updated EclipseLogAppender to decouple it from the plugin; it now requires the plugin bundle's symbolic name (as specified in the "Bundle-SymbolicName" property in the plugin's manifest), which is set in the logback config as seen below:
<configuration> <appender name="eclipse" class="ch.qos.logback.classic.** EclipseLogAppender"> <encoder> <pattern>[%method] > %msg%n</pattern> </encoder> <bundleName>com.example.e4.**helloworld</bundleName> </appender>
<root level="TRACE"> <appender-ref ref="eclipse" /> </root> </configuration>
______________________________**_________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>

On 24.05.2012 19:07, Tony Trinh wrote:
Thanks, Ceki. I'm thinking we can put EclipseLogAppender.java in logback-extensions [1] and package it as a JAR that users could add to their Eclipse projects. Separating it from the main logback source makes sense to me especially because it depends on a couple Eclipse packages. A link to it from the logback.qos.ch <http://logback.qos.ch> (or the documentation therein) might be helpful for users to find it.
Sure, logback-extensions sounds like a good home. Les Hazelwood has put in place quite a modular structure for logback-extensions. It would be probably useful to get his input on the integration of EclipseLogAppender. As you probably know already, you have commit privs on logback-extensions. David, as the person who initially suggested this appender, do you have any feedback on EclipseLogAppender? Tony, do you intend to use EclipseLogAppender in your own projects? BTW, in case you want to push content under the http://logback.qos.ch/extensions/ the procedure is very similar to that for http://logback.qos.ch/android/ with which you are already familiar.
Thoughts?
-- Ceki http://twitter.com/#!/ceki

On Thu, May 24, 2012 at 1:41 PM, ceki <ceki@qos.ch> wrote:
Sure, logback-extensions sounds like a good home. Les Hazelwood has put in place quite a modular structure for logback-extensions. It would be probably useful to get his input on the integration of EclipseLogAppender. As you probably know already, you have commit privs on logback-extensions.
I agree. I look forward to Les' input.
David, as the person who initially suggested this appender, do you have any feedback on EclipseLogAppender?
Tony, do you intend to use EclipseLogAppender in your own projects?
No, I don't have any current plans for it.
BTW, in case you want to push content under the http://logback.qos.ch/**extensions/ <http://logback.qos.ch/extensions/>the procedure is very similar to that for http://logback.qos.ch/android/ with which you are already familiar.
Ok.

Hi, First of, thanks for your example code Tony. I did however solve the problem in a slightly different way, and was able to have my appender code fully sepparated from the logback name space (packages). I was thinking I would write down the steps a bit more detailed in order the help others. I hope I can do this by tomorrow. I also thought I would post the source code of my appender class. BR David From: Tony Trinh Sent: Thursday, May 24, 2012 9:15 PM To: logback users list Subject: Re: [logback-user] RCP On Thu, May 24, 2012 at 1:41 PM, ceki <ceki@qos.ch> wrote: Sure, logback-extensions sounds like a good home. Les Hazelwood has put in place quite a modular structure for logback-extensions. It would be probably useful to get his input on the integration of EclipseLogAppender. As you probably know already, you have commit privs on logback-extensions. I agree. I look forward to Les' input. David, as the person who initially suggested this appender, do you have any feedback on EclipseLogAppender? Tony, do you intend to use EclipseLogAppender in your own projects? No, I don't have any current plans for it. BTW, in case you want to push content under the http://logback.qos.ch/extensions/ the procedure is very similar to that for http://logback.qos.ch/android/ with which you are already familiar. Ok. -------------------------------------------------------------------------------- _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user

On Thu, May 24, 2012 at 6:30 PM, David Virdefors < david.virdefors@purplescout.se> wrote:
** Hi,
First of, thanks for your example code Tony.
Sure, no problem :) I like challenges.
I did however solve the problem in a slightly different way, and was able to have my appender code fully sepparated from the logback name space (packages). I was thinking I would write down the steps a bit more detailed in order the help others. I hope I can do this by tomorrow. I also thought I would post the source code of my appender class.
Ah, of course...there's always a better way! ;) I, for one, am definitely interested in your source and instructions.
BR David

Hi, I tried to write a tutorial explaining what I did to get logback work in an Eclipse RCP plug-in environment. I also attached the source code for my Eclipse logback appender. http://code.oixx.se/#post0 Please let me know what you guys think. All feeback are welcome. Best Regards, David. From: logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch] On Behalf Of Tony Trinh Sent: den 26 maj 2012 06:23 To: logback users list Subject: Re: [logback-user] RCP On Thu, May 24, 2012 at 6:30 PM, David Virdefors <david.virdefors@purplescout.se> wrote: Hi, First of, thanks for your example code Tony. Sure, no problem :) I like challenges. I did however solve the problem in a slightly different way, and was able to have my appender code fully sepparated from the logback name space (packages). I was thinking I would write down the steps a bit more detailed in order the help others. I hope I can do this by tomorrow. I also thought I would post the source code of my appender class. Ah, of course...there's always a better way! ;) I, for one, am definitely interested in your source and instructions. BR David
participants (3)
-
ceki
-
David Virdefors
-
Tony Trinh