Log4JPlugin

Compatible with  IntelliJ IDEA
28.10.2014
37 433

Log4J Plugin Monitoring (LF5_SOCKET)

Features:

  • Table view of log messages;
  • Filtering by Level, Category, NDC and Message;
  • Quick link to source code from detail panel;

Configuration:

  • Download Log4JPlugin plugin
  • Configure log4j.xml socket appender
  • <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">

    <appender name="LF5_SOCKET" class="org.apache.log4j.net.SocketAppender">
      <param name="RemoteHost" value="localhost"/>
      <param name="Port" value="4454"/>
      <param name="LocationInfo" value="true"/>
      <param name="ReconnectionDelay" value="5000"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="
          [slf5s.start]
          %d{DATE}[slf5s.DATE]%n
          %p[slf5s.PRIORITY]%n
          ${server.name}[slf5s.NDC]%n
          %c[slf5s.CATEGORY]%n
          %l[slf5s.LOCATION]%n
          %m[slf5s.MESSAGE]%n%n"
        />
      </layout>
    </appender>

    <root>
      <priority value="debug"/>
      <appender-ref ref="LF5_SOCKET"/>
    </root>

    </log4j:configuration>

  • Configure log4j2.xml socket appender
  • <Configuration status="DEBUG">
     
     <Appenders>
      <Console name="STDOUT" target="SYSTEM_OUT"/>
      <Socket name="LF5_SOCKET" host="localhost" port="4454" protocol="TCP" reconnectionDelay="5000"/>
     </Appenders>
     
     <Loggers>
      <Root level="trace">
       <AppenderRef ref="STDOUT" level="DEBUG"/>
       <AppenderRef ref="LF5_SOCKET" level="DEBUG"/>
      </Root>
     </Loggers>
     
    </Configuration>

Download plugin

Version

Update date

Recent change notes

Corrected issues in handling exception and Thread Context (MDC) for log4j 2.x

General usage instructions

Log4J Plugin Monitoring (LF5_SOCKET) Features:

  • Table view of log messages;

  • Filtering by Level, Category, NDC and Message;

  • Quick link to source code from detail panel;

Configuration:

  • Download Log4JPlugin plugin

  • Configure log4j SocketAppender appender:

  • Add log4j SocketAppender into root:

Refer to plugin for sample log4j.xml amd log4j2.xml
Anonymous
30.06.2013
Cool plugin but i can't see threads logs only the main log
Anonymous
22.10.2008
This plugin is great but it crashes in IntelliJ Idea 7.0.3 and 7.0.4
27.06.2008
The plugin has been very useful, but stopped working in InteliJ 7.0.3
21.06.2006
I have decompiled it and made a simple change to make it work with IDEA 5.1.2
(it will probably work with all 5.x versions).

http://www.intellij.org/twiki/bin/view/Main/LogMonitorPlugin
http://www.intellij.org/twiki/pub/Main/LogMonitorPlugin/Log4jMonitor_36.jar

1) Install the plugin via IDE Settings | Plugins
2) Start IDEA: Log4jMonitor should work, except jumping to source code
3) shutdown IDEA
4) copy the updated jar to ~/.IntelliJIdea50/config/plugins/
5) restart IDEA

Maarten
Anonymous
20.06.2006
This plugin is/was extremely useful.

It works like chainsaw http://logging.apache.org/log4j/docs/chainsaw.html

but it has (or used to have) one very important additional feature: every logline has a hyperlink that makes IDEA jump to the line in your code that created the logging event.

And stacktraces also have these hyperlinks.

Unfortunately, this no longer works in IDEA 5.1.x
because IntelliJ changed the API.

Aiko Mastboom promised to send me the source code
so that I could fix this.
But now he stopped responding to my mails.

java.lang.NoSuchMethodError: com.intellij.openapi.fileEditor.OpenFileDescriptor. (Lcom/intellij/openapi/vfs/VirtualFile;II)V
at com.webspherious.intellij.utils.IntelliJFileUtils.openFile(IntelliJFileUtils.java:143)
at com.webspherious.intellij.Log4JPlugin.openFile(Log4JPlugin.java:129)
at com.webspherious.log4jmonitor.AbtractLog4JPlugin.openFileFromLink(AbtractLog4JPlugin.java:192)
at com.webspherious.log4jmonitor.DetailPanel$1.hyperlinkUpdate(DetailPanel.java:67)
at javax.swing.JEditorPane.fireHyperlinkUpdate(JEditorPane.java:320)
at javax.swing.text.html.HTMLEditorKit$LinkController.activateLink(HTMLEditorKit.java:827)
at javax.swing.text.html.HTMLEditorKit$LinkController.mouseClicked(HTMLEditorKit.java:637)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
at java.awt.Component.processMouseEvent(Component.java:5491)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:56)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:94)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:132)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Please  sign in  to leave a comment.