Search in sources :

Example 1 with RegexLoggingFilter

use of org.apache.cxf.common.logging.RegexLoggingFilter in project tomee by apache.

the class ServerImpl method initDestination.

private void initDestination(DestinationFactory destinationFactory) throws BusException, IOException {
    EndpointInfo ei = endpoint.getEndpointInfo();
    // Of course its not an ideal situation here to use a hard-coded prefix. To be refactored.
    if (destinationFactory == null) {
        if (ei.getAddress() != null && ei.getAddress().indexOf("local://") != -1) {
            destinationFactory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactoryForUri(ei.getAddress());
        }
        if (destinationFactory == null) {
            destinationFactory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactory(ei.getTransportId());
        }
    }
    destination = destinationFactory.getDestination(ei, bus);
    String wantFilter = ei.getAddress();
    if (wantFilter != null && wantFilter.startsWith("jms")) {
        RegexLoggingFilter filter = new RegexLoggingFilter();
        filter.setPattern("jms(.*?)password=+([^ ]+)");
        filter.setGroup(2);
        wantFilter = filter.filter(wantFilter).toString();
    }
    LOG.info("Setting the server's publish address to be " + wantFilter);
    serverRegistry = bus.getExtension(ServerRegistry.class);
    mep = new ManagedEndpoint(bus, endpoint, this);
    slcMgr = bus.getExtension(ServerLifeCycleManager.class);
    if (slcMgr != null) {
        slcMgr.registerListener(mep);
    }
    iMgr = bus.getExtension(InstrumentationManager.class);
    if (iMgr != null) {
        try {
            iMgr.register(mep);
        } catch (JMException jmex) {
            LOG.log(Level.WARNING, "Registering ManagedEndpoint failed.", jmex);
        }
    }
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) RegexLoggingFilter(org.apache.cxf.common.logging.RegexLoggingFilter) JMException(javax.management.JMException) InstrumentationManager(org.apache.cxf.management.InstrumentationManager)

Example 2 with RegexLoggingFilter

use of org.apache.cxf.common.logging.RegexLoggingFilter in project cxf by apache.

the class ServerImpl method initDestination.

private void initDestination(DestinationFactory destinationFactory) throws BusException, IOException {
    EndpointInfo ei = endpoint.getEndpointInfo();
    // Of course its not an ideal situation here to use a hard-coded prefix. To be refactored.
    if (destinationFactory == null) {
        if (ei.getAddress() != null && ei.getAddress().indexOf("local://") != -1) {
            destinationFactory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactoryForUri(ei.getAddress());
        }
        if (destinationFactory == null) {
            destinationFactory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactory(ei.getTransportId());
        }
    }
    destination = destinationFactory.getDestination(ei, bus);
    String wantFilter = ei.getAddress();
    if (wantFilter != null && wantFilter.startsWith("jms")) {
        RegexLoggingFilter filter = new RegexLoggingFilter();
        filter.setPattern("jms(.*?)password=+([^ ]+)");
        filter.setGroup(2);
        wantFilter = filter.filter(wantFilter).toString();
    }
    LOG.info("Setting the server's publish address to be " + wantFilter);
    serverRegistry = bus.getExtension(ServerRegistry.class);
    mep = new ManagedEndpoint(bus, endpoint, this);
    slcMgr = bus.getExtension(ServerLifeCycleManager.class);
    if (slcMgr != null) {
        slcMgr.registerListener(mep);
    }
    iMgr = bus.getExtension(InstrumentationManager.class);
    if (iMgr != null) {
        try {
            iMgr.register(mep);
        } catch (JMException jmex) {
            LOG.log(Level.WARNING, "Registering ManagedEndpoint failed.", jmex);
        }
    }
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) RegexLoggingFilter(org.apache.cxf.common.logging.RegexLoggingFilter) JMException(javax.management.JMException) InstrumentationManager(org.apache.cxf.management.InstrumentationManager)

Aggregations

JMException (javax.management.JMException)2 RegexLoggingFilter (org.apache.cxf.common.logging.RegexLoggingFilter)2 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)2 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)2