You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/03/10 21:22:39 UTC

cxf git commit: Update handling of hte @Logging annotation to use the new logging capabilities if available

Repository: cxf
Updated Branches:
  refs/heads/master f22e465e5 -> 54e7c58d5


Update handling of hte @Logging annotation to use the new logging capabilities if available


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/54e7c58d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/54e7c58d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/54e7c58d

Branch: refs/heads/master
Commit: 54e7c58d5449d5f91879674598fe1b1ee339a272
Parents: f22e465
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 10 16:22:12 2017 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 10 16:22:12 2017 -0500

----------------------------------------------------------------------
 .../cxf/bus/extension/ExtensionManagerBus.java  |  36 +------
 .../factory/AnnotationsFactoryBeanListener.java |  11 --
 .../factory/FactoryBeanListenerManager.java     |   3 +-
 .../factory/OldLoggingFactoryBeanListener.java  |  77 ++++++++++++++
 .../logging/LoggingBusLifecycleListener.java    |  83 +++++++++++++++
 .../ext/logging/LoggingFactoryBeanListener.java | 106 +++++++++++++++++++
 .../apache/cxf/ext/logging/LoggingFeature.java  |  28 +++--
 .../logging/event/PrintWriterEventSender.java   |   4 +
 .../resources/META-INF/cxf/bus-extensions.txt   |   2 +
 9 files changed, 293 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
index 008a57c..e240998 100644
--- a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
+++ b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
@@ -40,7 +40,6 @@ import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.NullConfigurer;
 import org.apache.cxf.feature.Feature;
-import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.resource.DefaultResourceManager;
 import org.apache.cxf.resource.ObjectTypeResolver;
@@ -59,30 +58,7 @@ import org.apache.cxf.transport.DestinationFactoryManager;
  */
 public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implements Bus {
     public static final String BUS_PROPERTY_NAME = "bus";
-    static final boolean FORCE_LOGGING;
-    static final boolean FORCE_PRETTY;
-    static {
-        boolean b = false;
-        boolean pretty = false;
-        try {
-            String prop = System.getProperty("org.apache.cxf.logging.enabled", "false");
-            if ("pretty".equals(prop)) {
-                b = true;
-                pretty = true;
-            } else {
-                b = Boolean.parseBoolean(prop);
-                //treat these all the same
-                b |= Boolean.getBoolean("com.sun.xml.ws.transport.local.LocalTransportPipe.dump");
-                b |= Boolean.getBoolean("com.sun.xml.ws.util.pipe.StandaloneTubeAssembler.dump");
-                b |= Boolean.getBoolean("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump");
-                b |= Boolean.getBoolean("com.sun.xml.ws.transport.http.HttpAdapter.dump");
-            }
-        } catch (Throwable t) {
-            //ignore
-        }
-        FORCE_LOGGING = b;
-        FORCE_PRETTY = pretty;
-    }
+
     private static final String BUS_ID_PROPERTY_NAME = "org.apache.cxf.bus.id";
 
     protected final Map<Class<?>, Object> extensions;
@@ -109,11 +85,6 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem
         state = BusState.INITIAL;
 
         CXFBusFactory.possiblySetDefaultBus(this);
-        if (FORCE_LOGGING) {
-            LoggingFeature feature = new LoggingFeature();
-            feature.setPrettyLogging(FORCE_PRETTY);
-            features.add(feature);
-        }
         if (null != props) {
             properties.putAll(props);
         }
@@ -354,11 +325,6 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem
     public synchronized void setFeatures(Collection<? extends Feature> features) {
         this.features.clear();
         this.features.addAll(features);
-        if (FORCE_LOGGING) {
-            LoggingFeature feature = new LoggingFeature();
-            feature.setPrettyLogging(FORCE_PRETTY);
-            this.features.add(feature);
-        }
         if (state == BusState.RUNNING) {
             initializeFeatures();
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java b/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
index cfb45ff..90dca4f 100644
--- a/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
+++ b/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
@@ -30,7 +30,6 @@ import org.apache.cxf.annotations.EndpointProperty;
 import org.apache.cxf.annotations.FactoryType;
 import org.apache.cxf.annotations.FastInfoset;
 import org.apache.cxf.annotations.GZIP;
-import org.apache.cxf.annotations.Logging;
 import org.apache.cxf.annotations.SchemaValidation;
 import org.apache.cxf.annotations.WSDLDocumentation;
 import org.apache.cxf.annotations.WSDLDocumentation.Placement;
@@ -39,7 +38,6 @@ import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.FIStaxInInterceptor;
 import org.apache.cxf.interceptor.FIStaxOutInterceptor;
@@ -97,7 +95,6 @@ public class AnnotationsFactoryBeanListener implements FactoryBeanListener {
             addSchemaValidationSupport(ep, cls.getAnnotation(SchemaValidation.class));
             addFastInfosetSupport(ep, cls.getAnnotation(FastInfoset.class));
             addGZipSupport(ep, bus, cls.getAnnotation(GZIP.class));
-            addLoggingSupport(ep, bus, cls.getAnnotation(Logging.class));
             addEndpointProperties(ep, bus, cls.getAnnotation(EndpointProperty.class));
             EndpointProperties props = cls.getAnnotation(EndpointProperties.class);
             if (props != null) {
@@ -151,7 +148,6 @@ public class AnnotationsFactoryBeanListener implements FactoryBeanListener {
             addGZipSupport(server.getEndpoint(), bus, cls.getAnnotation(GZIP.class));
             addSchemaValidationSupport(server.getEndpoint(), cls.getAnnotation(SchemaValidation.class));
             addFastInfosetSupport(server.getEndpoint(), cls.getAnnotation(FastInfoset.class));
-            addLoggingSupport(server.getEndpoint(), bus, cls.getAnnotation(Logging.class));
             addEndpointProperties(server.getEndpoint(), bus, cls.getAnnotation(EndpointProperty.class));
             EndpointProperties props = cls.getAnnotation(EndpointProperties.class);
             if (props != null) {
@@ -276,13 +272,6 @@ public class AnnotationsFactoryBeanListener implements FactoryBeanListener {
         }
     }
 
-    private void addLoggingSupport(Endpoint endpoint, Bus bus, Logging annotation) {
-        if (annotation != null) {
-            LoggingFeature lf = new LoggingFeature(annotation);
-            lf.initialize(endpoint, bus);
-        }
-    }
-
     private void addGZipSupport(Endpoint ep, Bus bus, GZIP annotation) {
         if (annotation != null) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java b/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
index af07871..e8ef830 100644
--- a/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
+++ b/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
@@ -40,6 +40,7 @@ public class FactoryBeanListenerManager {
 
     public FactoryBeanListenerManager() {
         listeners.add(new AnnotationsFactoryBeanListener());
+        listeners.add(new OldLoggingFactoryBeanListener());
     }
     public FactoryBeanListenerManager(Bus b) {
         this();
@@ -55,7 +56,7 @@ public class FactoryBeanListenerManager {
         ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
         if (loc != null) {
             for (FactoryBeanListener f : loc.getBeansOfType(FactoryBeanListener.class)) {
-                listeners.addIfAbsent(f);
+                listeners.add(0, f);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/core/src/main/java/org/apache/cxf/service/factory/OldLoggingFactoryBeanListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/service/factory/OldLoggingFactoryBeanListener.java b/core/src/main/java/org/apache/cxf/service/factory/OldLoggingFactoryBeanListener.java
new file mode 100644
index 0000000..bef3c38
--- /dev/null
+++ b/core/src/main/java/org/apache/cxf/service/factory/OldLoggingFactoryBeanListener.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.service.factory;
+
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.annotations.Logging;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+
+/**
+ *
+ */
+public class OldLoggingFactoryBeanListener implements FactoryBeanListener {
+    static final Logger LOG = LogUtils.getL7dLogger(OldLoggingFactoryBeanListener.class);
+
+    /** {@inheritDoc}*/
+    public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args) {
+        switch (ev) {
+        case ENDPOINT_SELECTED: {
+            Class<?> cls = (Class<?>)args[2];
+            Endpoint ep = (Endpoint)args[1];
+            Bus bus = factory.getBus();
+            // To avoid the NPE
+            if (cls == null) {
+                return;
+            }
+            addLoggingSupport(ep, bus, cls.getAnnotation(Logging.class));
+            break;
+        }
+        case SERVER_CREATED: {
+            Class<?> cls = (Class<?>)args[2];
+            if (cls == null) {
+                return;
+            }
+            Server server = (Server)args[0];
+            Bus bus = factory.getBus();
+            addLoggingSupport(server.getEndpoint(), bus, cls.getAnnotation(Logging.class));
+            break;
+        }
+        default:
+            //do nothing
+        }
+    }
+
+
+    private void addLoggingSupport(Endpoint endpoint, Bus bus, Logging annotation) {
+        if (annotation != null) {
+            @SuppressWarnings("deprecation")
+            org.apache.cxf.feature.LoggingFeature lf = new org.apache.cxf.feature.LoggingFeature(annotation);
+            LOG.warning("Deprecated logging interceptors being used, switch to cxf-rt-ext-logging based logging.");
+            lf.initialize(endpoint, bus);
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingBusLifecycleListener.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingBusLifecycleListener.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingBusLifecycleListener.java
new file mode 100644
index 0000000..98f1e74
--- /dev/null
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingBusLifecycleListener.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ext.logging;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.buslifecycle.BusLifeCycleListener;
+import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+
+/**
+ * 
+ */
+public class LoggingBusLifecycleListener implements BusLifeCycleListener {
+    
+    static final boolean FORCE_LOGGING;
+    static final boolean FORCE_PRETTY;
+    static {
+        boolean b = false;
+        boolean pretty = false;
+        try {
+            String prop = System.getProperty("org.apache.cxf.logging.enabled", "false");
+            if ("pretty".equals(prop)) {
+                b = true;
+                pretty = true;
+            } else {
+                b = Boolean.parseBoolean(prop);
+                //treat these all the same
+                b |= Boolean.getBoolean("com.sun.xml.ws.transport.local.LocalTransportPipe.dump");
+                b |= Boolean.getBoolean("com.sun.xml.ws.util.pipe.StandaloneTubeAssembler.dump");
+                b |= Boolean.getBoolean("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump");
+                b |= Boolean.getBoolean("com.sun.xml.ws.transport.http.HttpAdapter.dump");
+            }
+        } catch (Throwable t) {
+            //ignore
+        }
+        FORCE_LOGGING = b;
+        FORCE_PRETTY = pretty;
+    }
+
+    private final Bus bus;
+    public LoggingBusLifecycleListener(Bus b) {
+        bus = b;
+        bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(this);
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    public void initComplete() {
+        if (FORCE_LOGGING) {
+            LoggingFeature feature = new LoggingFeature();
+            feature.setPrettyLogging(FORCE_PRETTY);
+            bus.getFeatures().add(feature);
+            feature.initialize(bus);
+        }
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    public void preShutdown() {
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    public void postShutdown() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFactoryBeanListener.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFactoryBeanListener.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFactoryBeanListener.java
new file mode 100644
index 0000000..f4f31d3
--- /dev/null
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFactoryBeanListener.java
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ext.logging;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.net.URI;
+
+import org.apache.cxf.Bus;
+
+import org.apache.cxf.annotations.Logging;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.ext.logging.event.PrintWriterEventSender;
+import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
+import org.apache.cxf.service.factory.FactoryBeanListener;
+import org.apache.cxf.service.factory.FactoryBeanListenerManager;
+
+/**
+ *
+ */
+public class LoggingFactoryBeanListener implements FactoryBeanListener {
+
+    public LoggingFactoryBeanListener(Bus b) {
+        FactoryBeanListenerManager m = b.getExtension(FactoryBeanListenerManager.class);
+        for (FactoryBeanListener f : m.getListeners()) {
+            if (f.getClass().getSimpleName().equals("OldLoggingFactoryBeanListener")) {
+                m.removeListener(f);
+            }
+        }
+    }
+
+    /** {@inheritDoc}*/
+    public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args) {
+        switch (ev) {
+        case ENDPOINT_SELECTED: {
+            Class<?> cls = (Class<?>)args[2];
+            Endpoint ep = (Endpoint)args[1];
+            Bus bus = factory.getBus();
+            // To avoid the NPE
+            if (cls == null) {
+                return;
+            }
+            addLoggingSupport(ep, bus, cls.getAnnotation(Logging.class));
+            break;
+        }
+        case SERVER_CREATED: {
+            Class<?> cls = (Class<?>)args[2];
+            if (cls == null) {
+                return;
+            }
+            Server server = (Server)args[0];
+            Bus bus = factory.getBus();
+            addLoggingSupport(server.getEndpoint(), bus, cls.getAnnotation(Logging.class));
+            break;
+        }
+        default:
+            //do nothing
+        }
+    }
+
+    private void addLoggingSupport(Endpoint endpoint, Bus bus, Logging annotation) {
+        if (annotation != null) {
+            LoggingFeature lf = new LoggingFeature();
+            lf.setPrettyLogging(annotation.pretty());
+            lf.setLimit(annotation.limit());
+            lf.setLogBinary(annotation.showBinary());
+            
+            if ("<stdout>".equals(annotation.outLocation())) {
+                lf.setOutSender(new PrintWriterEventSender(System.out));
+            } else if ("<stderr>".equals(annotation.outLocation())) {
+                lf.setOutSender(new PrintWriterEventSender(System.err));                
+            } else if (annotation.outLocation().startsWith("file:")) {
+                try {
+                    URI uri = new URI(annotation.outLocation());
+                    File file = new File(uri);
+                    PrintWriter writer = new PrintWriter(new FileWriter(file, true), true);
+                    lf.setOutSender(new PrintWriterEventSender(writer));
+                } catch (Exception ex) {
+                    //stick with default
+                }
+            }
+            lf.initialize(endpoint, bus);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
index 51d33e9..1518752 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
@@ -47,16 +47,17 @@ import org.apache.cxf.interceptor.InterceptorProvider;
 @NoJSR250Annotations
 @Provider(value = Type.Feature)
 public class LoggingFeature extends AbstractFeature {
-    private LogEventSender sender;
     private LoggingInInterceptor in;
     private LoggingOutInterceptor out;
-    private PrettyLoggingFilter prettyFilter;
+    private PrettyLoggingFilter inPrettyFilter;
+    private PrettyLoggingFilter outPrettyFilter;
 
     public LoggingFeature() {
-        this.sender = new Slf4jVerboseEventSender();
-        prettyFilter = new PrettyLoggingFilter(sender);
-        in = new LoggingInInterceptor(prettyFilter);
-        out = new LoggingOutInterceptor(prettyFilter);
+        LogEventSender sender = new Slf4jVerboseEventSender();
+        inPrettyFilter = new PrettyLoggingFilter(sender);
+        outPrettyFilter = new PrettyLoggingFilter(sender);
+        in = new LoggingInInterceptor(inPrettyFilter);
+        out = new LoggingOutInterceptor(outPrettyFilter);
     }
 
     @Override
@@ -80,11 +81,19 @@ public class LoggingFeature extends AbstractFeature {
     }
 
     public void setSender(LogEventSender sender) {
-        this.prettyFilter.setNext(sender);
+        this.inPrettyFilter.setNext(sender);
+        this.outPrettyFilter.setNext(sender);
+    }
+    public void setInSender(LogEventSender s) {
+        this.inPrettyFilter.setNext(s);
+    }
+    public void setOutSender(LogEventSender s) {
+        this.outPrettyFilter.setNext(s);
     }
 
     public void setPrettyLogging(boolean prettyLogging) {
-        this.prettyFilter.setPrettyLogging(prettyLogging);
+        this.inPrettyFilter.setPrettyLogging(prettyLogging);
+        this.outPrettyFilter.setPrettyLogging(prettyLogging);
     }
 
     /**
@@ -106,7 +115,6 @@ public class LoggingFeature extends AbstractFeature {
     }
     
     public void setVerbose(boolean verbose) {
-        this.sender = verbose ? new Slf4jVerboseEventSender() : new Slf4jEventSender();
-        this.prettyFilter.setNext(sender);
+        setSender(verbose ? new Slf4jVerboseEventSender() : new Slf4jEventSender());
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/PrintWriterEventSender.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/PrintWriterEventSender.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/PrintWriterEventSender.java
index daa657e..aedf3f7 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/PrintWriterEventSender.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/PrintWriterEventSender.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ext.logging.event;
 
+import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.time.Instant;
 
@@ -31,6 +32,9 @@ public class PrintWriterEventSender implements LogEventSender {
     public PrintWriterEventSender(PrintWriter writer) {
         this.writer = writer;
     }
+    public PrintWriterEventSender(PrintStream ps) {
+        this.writer = new PrintWriter(ps);
+    }
 
     /** {@inheritDoc}*/
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/54e7c58d/rt/features/logging/src/main/resources/META-INF/cxf/bus-extensions.txt
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/resources/META-INF/cxf/bus-extensions.txt b/rt/features/logging/src/main/resources/META-INF/cxf/bus-extensions.txt
new file mode 100644
index 0000000..cf0d294
--- /dev/null
+++ b/rt/features/logging/src/main/resources/META-INF/cxf/bus-extensions.txt
@@ -0,0 +1,2 @@
+org.apache.cxf.ext.logging.LoggingFactoryBeanListener::true
+org.apache.cxf.ext.logging.LoggingBusLifecycleListener::true