Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Logback to work nicely with Eclipse?

How do I get my logging framework (currently Logback) to play nicely with Eclipse? In particular, it would be nice to click on a log statement and be taken to the line where it was produced.

I'm aware of the Logback Eclipse Plugin however apparently it is outdated, and only works with an old version of Logback.

Is there some other logging framework that works better with Eclipse? I assume there must be a nice way to do this.

like image 987
sanity Avatar asked Apr 12 '12 20:04

sanity


2 Answers

I use this pattern:

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level (%file:%line\) - %message%n</pattern>
    </encoder>
</appender>

The (%file:%line) part is by default clickable in the Eclipse console.

like image 95
Jakub Adamek Avatar answered Oct 22 '22 08:10

Jakub Adamek


If you add %callerto the pattern, then the functionality of the Console of Eclipse can handle your problem...

like image 43
Tonny Madsen Avatar answered Oct 22 '22 10:10

Tonny Madsen