问题
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.
回答1:
If you add %callerto the pattern, then the functionality of the Console of Eclipse can handle your problem...
回答2:
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.
来源:https://stackoverflow.com/questions/10131741/how-do-i-get-logback-to-work-nicely-with-eclipse