logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahesh Dilhan <mail.mahesh...@gmail.com>
Subject Log4j2 - JConsole JMX appender
Date Tue, 29 Oct 2013 00:58:54 GMT
Hi All,

i'm interested in learning on JMX monitoring in log4j2.

As explained I was able to get the log4j2 'tab' > statusLogger child tab in
JConsole with the initial logging statements.

Note:version : 2.0.9beta

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- No need to set system property "Log4jContextSelector" to any value
     when using <asyncLogger> or <asyncRoot>. -->

<Configuration status="debug">
  <Appenders>
    <!-- Async Loggers will auto-flush in batches, so switch off
immediateFlush. -->
    <RandomAccessFile name="RandomAccessFile"
fileName="asyncWithLocation.log"
              immediateFlush="false" append="false">
      <PatternLayout>
        <Pattern>%d %p %class{1.} [%t] %location %m %ex%n</Pattern>
      </PatternLayout>
    </RandomAccessFile>

  </Appenders>
  <Loggers >
    <!-- pattern layout actually uses location, so we need to include it -->
    <AsyncLogger  name="notificationLogger" level="trace"
includeLocation="true">
      <AppenderRef ref="RandomAccessFile"/>
    </AsyncLogger>
    <Root level="debug" includeLocation="true">
      <AppenderRef ref="notificationLogger"/>
    </Root>
  </Loggers>
</Configuration>

<!-- notificationLogger -->
private static Logger logger = LogManager.getLogger("notificationLogger");


When web Application(java/servlet/spring) runs I can see the
file[asyncWithLocation.log] get appended with the logging statements,
I like to see Jconsole get appended too, But It did not.


I wonder, what configuration I should use to enable jmx logging, so that I
can see them in JConsole?

is there any documentation other than this
http://logging.apache.org/log4j/2.x/manual/jmx.html,

it would be great if above documentation is updated with a sample of
log4j2.xml configuration.

Thanks

Mahesh

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message