Hi Mahesh,

Thank you for re-posting your question to the user mailing list.

The Status Logger is a special logger used by log4j internally.
If you set it to "debug" or "trace" (by starting your config xml file
with <Configuration
status="debug">...),
it will output things like which appenders and loggers were initialized,
which log4j plugins were found, etc.
Any configuration problems will show up in the status log.
The status log output will appear on the console (System.out).

In JConsole, this internal logging is what you see in the StatusLogger tab.

I'm guessing from your question that you would like to see the log
statements produced by your application in the JConsole viewer.
Unfortunately, JMX currently does not provide a way to show the content of
application log files.

If you are looking for a tool that allows you to view the log file from a
remote machine you may want to take a look at Chainsaw.
http://logging.apache.org/chainsaw/

Scott Deboy has been doing work to make Chainsaw's zeroconf feature work
well with log4j2.
I am not that familiar with Chainsaw, but perhaps this documentation can
get you started:
http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations

Best regards,
Remko



On Tue, Oct 29, 2013 at 9:58 AM, Mahesh Dilhan <[email protected]>wrote:

> 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
>

Reply via email to