10

In the IntelliJ console, stack traces automatically contain hyperlinks that bring you to the relevant source files. The links appear at the end of each line in the format (Log4jLoggerTest.java:25). I can configure log4j to output text in a similar format.

log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} (%F:%L) - %m%n

In eclipse, the console automatically turned text like this into links. In IntelliJ, the stack traces are links but my own output in the same form remains un-linked. Is there any way to get IntelliJ to do the same?

Craig P. Motlin
  • 26,452
  • 17
  • 99
  • 126

5 Answers5

12

Yes you can, try this pattern:

<param name="ConversionPattern" value="%-5p - [%-80m] - at %c.%M(%F:%L)%n"/>
4

There is a plugin for IntelliJ IDEA to get clickable links in your console called Awesome Console.

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
Tim
  • 41
  • 1
2

FYI, in logback and Intellij 13 this worked for me:

<pattern>%d{dd-MM-yyyy} %d{HH:mm:ss} %p %m - at %C.%M\(%F:%L\)%n</pattern>

Note: I needed the "at" and I also needed to escape the parentheses. Also capital "C" is the fully qualified classname in logback.

With this config I get output like:

10-06-2014 10:10:58 INFO Bean 'mbeanServer' of type [class com.sun.jmx.mbeanserver.JmxMBeanServer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) - at org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker.postProcessAfterInitialization(AbstractApplicationContext.java:1374)

And the final part in parentheses shows up as a link in Intellij.

Michael Rush
  • 3,950
  • 3
  • 27
  • 23
Ryan Walls
  • 6,962
  • 1
  • 39
  • 42
1

I don't think there is a way. But I think I submitted this as a feature request a long time ago. Maybe you should do the same. Jetbrains does listen to its customers. But it can take ages before they implement things like this.

Stefan Arentz
  • 34,311
  • 8
  • 67
  • 88
1

This works for me:

log4j.appender.console.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}]%5p %l %m%n