<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>