Interface AsyncAppenderAdminMBean

  • All Known Implementing Classes:
    AsyncAppenderAdmin

    public interface AsyncAppenderAdminMBean
    The MBean interface for monitoring and managing an AsyncAppender.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String PATTERN
      ObjectName pattern ("org.apache.logging.log4j2:type=%s,component=AsyncAppenders,name=%s" ) for AsyncAppenderAdmin MBeans.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String[] getAppenderRefs()
      Returns a String array with the appender refs configured for the instrumented AsyncAppender.
      String getErrorHandler()
      Returns the result of calling toString on the error handler of this appender, or "null" if no error handler was set.
      String getErrorRef()
      Returns the name of the appender that any errors are logged to or null.
      String getFilter()
      Returns a string description of all filters configured for the instrumented AsyncAppender.
      String getLayout()
      Returns the result of calling toString on the Layout object of the instrumented AsyncAppender.
      String getName()
      Returns the name of the instrumented AsyncAppender.
      int getQueueCapacity()  
      int getQueueRemainingCapacity()  
      boolean isBlocking()
      Returns true if this AsyncAppender will block when the queue is full, or false if events are dropped when the queue is full.
      boolean isIgnoreExceptions()
      Returns how exceptions thrown on the instrumented AsyncAppender are handled.
      boolean isIncludeLocation()
      Returns true if this AsyncAppender will take a snapshot of the stack with every log event to determine the class and method where the logging call was made.
    • Field Detail

      • PATTERN

        static final String PATTERN
        ObjectName pattern ("org.apache.logging.log4j2:type=%s,component=AsyncAppenders,name=%s" ) for AsyncAppenderAdmin MBeans. This pattern contains two variables, where the first is the name of the context, the second is the name of the instrumented appender.

        You can find all registered AsyncAppenderAdmin MBeans like this:

         MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
         String pattern = String.format(AsyncAppenderAdminMBean.PATTERN, "*", "*");
         Set<ObjectName> appenderNames = mbs.queryNames(new ObjectName(pattern), null);
         

        Some characters are not allowed in ObjectNames. The logger context name and appender name may be quoted. When AsyncAppenderAdmin MBeans are registered, their ObjectNames are created using this pattern as follows:

         String ctxName = Server.escape(loggerContext.getName());
         String appenderName = Server.escape(appender.getName());
         String name = String.format(PATTERN, ctxName, appenderName);
         ObjectName objectName = new ObjectName(name);
         
        See Also:
        Server.escape(String), Constant Field Values
    • Method Detail

      • getName

        String getName()
        Returns the name of the instrumented AsyncAppender.
        Returns:
        the name of the AsyncAppender
      • getLayout

        String getLayout()
        Returns the result of calling toString on the Layout object of the instrumented AsyncAppender.
        Returns:
        the Layout of the instrumented AsyncAppender as a string
      • isIgnoreExceptions

        boolean isIgnoreExceptions()
        Returns how exceptions thrown on the instrumented AsyncAppender are handled.
        Returns:
        true if any exceptions thrown by the AsyncAppender will be logged or false if such exceptions are re-thrown.
      • getErrorHandler

        String getErrorHandler()
        Returns the result of calling toString on the error handler of this appender, or "null" if no error handler was set.
        Returns:
        result of calling toString on the error handler of this appender, or "null"
      • getFilter

        String getFilter()
        Returns a string description of all filters configured for the instrumented AsyncAppender.
        Returns:
        a string description of all configured filters for this appender
      • getAppenderRefs

        String[] getAppenderRefs()
        Returns a String array with the appender refs configured for the instrumented AsyncAppender.
        Returns:
        the appender refs for the instrumented AsyncAppender.
      • isIncludeLocation

        boolean isIncludeLocation()
        Returns true if this AsyncAppender will take a snapshot of the stack with every log event to determine the class and method where the logging call was made.
        Returns:
        true if location is included with every event, false otherwise
      • isBlocking

        boolean isBlocking()
        Returns true if this AsyncAppender will block when the queue is full, or false if events are dropped when the queue is full.
        Returns:
        whether this AsyncAppender will block or drop events when the queue is full.
      • getErrorRef

        String getErrorRef()
        Returns the name of the appender that any errors are logged to or null.
        Returns:
        the name of the appender that any errors are logged to or null
      • getQueueCapacity

        int getQueueCapacity()
      • getQueueRemainingCapacity

        int getQueueRemainingCapacity()