I log quite a bit of stuff, and have noticed that Eclipse Console makes Java stacktraces clickable. The exception is highlighted (goes to the "Create Breakpoint" dialog box) and the filename + numbers are highlighted too (allows going straight to that line).
I was wondering if I could format my normal log lines so the Eclipse Console would do the same to them. A possible approach could be making them look like stack trace lines, but in order to keep as much information as possible I would like to know the exact rule that Eclipse use to detect these lines, but Eclipse 3.6.2 is rather big so it is a herculean task.
The question is then, what are the rules in play here, and where are they defined?
Edit: The logback pattern layout snippet is
This snippet may help. It can be placed anywhere in your code and will print a "clickable" line on the eclipse console:
StackTraceElement s = Thread.currentThread().getStackTrace();
System.out.printf("%s.%s(%s:%s)%n", s.getClassName(), s.getMethodName(),
This question has an answer, that may include a solution for your problem:
Eclipse console: detect warning and error patterns and make them clickable
Here we go: we have to contribute an implementation of
org.eclipse.ui.console.IPatternMatchListenerDelegatethrough extension point
The contributions that provide hyperlinks for exceptions and line numbers in stack traces are defined in the
org.eclipse.jdt.debug.ui plugin, the implementing classes are in the same bundle.
The rules are regular expressions and can be found in the
plugin.xml of the contributing plugin.
If you print
(filename:lineNumber), Eclipse will convert it to a link.
I don't know if there are other rules or where they are defined.