Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-9467

The JMX Bean associated with a LogContext must be made available

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.0.0.Final
    • Logging
    • None
    • Low

      Class org.jboss.logmanager.LogContext has an associated instance of LoggingMXBeanImpl. If per-application logging is enabled a new instances of LogContext and LoggingMXBeanImpl are created. But the LoggingMXBeanImpl is not registered as an MBean. It is therefore not possible to change log levels dynamically.

            [JBAS-9467] The JMX Bean associated with a LogContext must be made available

            There is a workaround. It is published here: http://lea-ka.blogspot.com/2011/09/dynamically-changing-app-specific.html

            I guess the easiest way to fix this issue is to change class org.jboss.logging.metadata.LoggingMetaDataHelper, method createBeanMetaData.
            This piece of code makes sure the required log contexts are created:

                    if (defineContextMetaDataList != null) for (DefineContextMetaData defineContextMetaData : defineContextMetaDataList) {
                        final String contextName = defineContextMetaData.getName();
                        final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(getContextName(contextName == null ? context : contextName), LogContext.class.getName());
                        builder.setFactoryMethod("create");
                        beanMetaDataList.add(builder.getBeanMetaData());
                    }
            

            The fix would change the code so that not only the context is created but also its MBean is registered, more or less in line with the published workaround.

            Leonid Kosmylev (Inactive) added a comment - - edited There is a workaround. It is published here: http://lea-ka.blogspot.com/2011/09/dynamically-changing-app-specific.html I guess the easiest way to fix this issue is to change class org.jboss.logging.metadata.LoggingMetaDataHelper, method createBeanMetaData. This piece of code makes sure the required log contexts are created: if (defineContextMetaDataList != null ) for (DefineContextMetaData defineContextMetaData : defineContextMetaDataList) { final String contextName = defineContextMetaData.getName(); final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(getContextName(contextName == null ? context : contextName), LogContext. class. getName()); builder.setFactoryMethod( "create" ); beanMetaDataList.add(builder.getBeanMetaData()); } The fix would change the code so that not only the context is created but also its MBean is registered, more or less in line with the published workaround.

              Unassigned Unassigned
              klv_m72 Leonid Kosmylev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated: