Is it possible to have clickable class names in console output in IntelliJ?
There is. Taken from online help http://www.jetbrains.com/idea/webhelp/setting-log-options.html
If you are using third-party logging tools, you might want to make the message's output, that mimics a standard linkage to the source code as for stacktrace line (at .(:)). For that, you should add specific Conversion Pattern to your log.xml configuration file. For example, in a log4j Conversion Pattern this would be
<param name="ConversionPattern" value="%-5p - [%-80m] - at %c.%M(%F:%L)%n"/>
However the produces output is quite ugly with fully qualified names, method names etc.
As of IntelliJ 14 and alternative to digging through IntelliJ settings, some trial and error revealed that anything with the pattern
(anyfile.ext:line)
preceded by at least one .
in the console gets turned into a file link if there any file known by that name, e.g. .(Whatever.java:55)
, in the workspace excluding those of libraries.
I am using logback. So at a minimum in my logback.xml to get links to my classes I included in my message pattern
.\(%class{0}.java:%line\)
.\( \)
-> A dot must precede the filename:line pattern and the filename:line pattern enclosed in parentheses. Logback requires literal parentheses to be escaped in this case.%class{0}
-> Just the classname without a package.java
-> So that it matches the complete filename:%line
-> Is the logging line of code
In actuality, I have other things which always includes at least one .
before the (filename:line)
portion, so it is being picked up by IntelliJ just as well.
<pattern>%highlight(%-5level) %d{yyyy-MM-dd'T'HH:mm:ss.SSS} %yellow([%thread]) %blue(%logger{36}\(%class{0}.java:%line\)) %msg%n</pattern>