log4j 1.2的org.apache.log4j.jmx生产可用性及AsyncLogger监控咨询
First, let's clarify the production quality question around org.apache.log4j.jmx: the official Log4j 1.2 documentation clearly states:
unfortunately managing log4j settings is not production ready
It's critical to parse this correctly: this warning applies specifically to modifying log4j configurations via JMX (like adjusting log levels, adding appenders, etc.). Read-only monitoring operations, though, carry minimal risk and are generally safe for production environments.
Now, to your specific ask about monitoring AsyncLogger's buffer size with JConsole or HP Diagnostics:
JConsole: Totally feasible. Log4j 1.2's AsyncLogger exposes JMX MBeans under the
org.apache.log4jdomain. Once you connect JConsole to your target JVM, you can locate the relevant MBean and access read-only buffer-related properties—thinkBufferSize(total capacity) andRemainingCapacity(available space). Since this is a read-only operation, it doesn't involve any configuration changes, so you avoid the "not production ready" caveat from the docs.HP Diagnostics: This works as well. HP Diagnostics supports JMX-based monitoring natively. After setting up the tool to connect to your JVM's JMX endpoint, you can configure monitors for the AsyncLogger MBean's buffer attributes. Just like with JConsole, sticking to read-only monitoring means you won't encounter the stability risks associated with configuration modifications.
A quick note to keep in mind: if you ever consider using JMX to modify AsyncLogger settings (like dynamically adjusting buffer size), that's where you'd hit the production readiness issue the docs warn about. But for pure buffer metric monitoring, you're good to go.
内容的提问来源于stack exchange,提问作者Mike

