
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>