jbosswildflywildfly-8jbossws

How to enable JBossWS' LogRecorders globally?


I'm using Wildfly 8.1.0.Final.

I have RecordingServerHandler configured, it does get triggered by web services' messages. The problem is, LogRecorders are disabled by default.

The Records management article says:

Default processors are not in recording mode upon creation, thus you need to switch them to recording mode through their MBean interfaces (see the Recording flag in the jmx-console).

Enabling them in runtime one by one for each endpoint won't do, I need to enable them globally at "development time".

The same article says:

The recorders can be configured in the stacks bean configuration

<!-- Installed Record Processors-->  
<bean name="WSMemoryBufferRecorder" class="org.jboss.wsf.framework.management.recording.MemoryBufferRecorder">  
    <property name="recording">false</property>  
</bean>  
<bean name="WSLogRecorder" class="org.jboss.wsf.framework.management.recording.LogRecorder">  
    <property name="recording">false</property>  
</bean>  

What's "stacks bean configuration"? Does the specified WSLogRecorder name imply that this configuration creates another, non-default, LogRecorder by that name, and that I would need to add it to all endpoints somehow?


Solution

  • Ended up enabling them via JMX at the end of deployment.

    import java.lang.management.ManagementFactory;
    import java.util.Set;
    
    import javax.management.Attribute;
    import javax.management.MBeanServer;
    import javax.management.ObjectName;
    
    /* ... */
    
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    Set<ObjectName> recorderNames = server.queryNames(
            new ObjectName("jboss.ws:recordProcessor=LogRecorder,*"), null);
    for (ObjectName recorderName : recorderNames) {
        server.setAttribute(recorderName, new Attribute("Recording", true));
    }