[2/2] cxf git commit: [CXF-6251] Allowing system property for message logging to do pretty printing This closes #53
[CXF-6251] Allowing system property for message logging to do pretty printing This closes #53 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/48084ffd Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/48084ffd Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/48084ffd Branch: refs/heads/3.0.x-fixes Commit: 48084ffd0625178e758c52ffcf2b695206ef8015 Parents: d2a0c47 Author: Kyle Lape Authored: Sun Feb 8 18:52:46 2015 -0800 Committer: Daniel Kulp Committed: Tue Feb 10 16:53:46 2015 -0500 -- .../cxf/bus/extension/ExtensionManagerBus.java | 29 ++-- 1 file changed, 21 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/48084ffd/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 0478279..909ed8a 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 @@ -61,19 +61,28 @@ 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 { -b = Boolean.getBoolean("org.apache.cxf.logging.enabled"); -//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"); +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"; @@ -102,7 +111,9 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem CXFBusFactory.possiblySetDefaultBus(this); if (FORCE_LOGGING) { -features.add(new LoggingFeature()); +LoggingFeature feature = new LoggingFeature(); +feature.setPrettyLogging(FORCE_PRETTY); +features.add(feature); } if (null == properties) { properties = new HashMap(); @@ -345,7 +356,9 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem this.features.clear(); this.features.addAll(features); if (FORCE_LOGGING) { -this.features.add(new LoggingFeature()); +LoggingFeature feature = new LoggingFeature(); +feature.setPrettyLogging(FORCE_PRETTY); +this.features.add(feature); } if (state == BusState.RUNNING) { initializeFeatures();
cxf git commit: [CXF-6251] Allowing system property for message logging to do pretty printing This closes #53
Repository: cxf Updated Branches: refs/heads/master 26aaa5997 -> fe5eedda5 [CXF-6251] Allowing system property for message logging to do pretty printing This closes #53 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/fe5eedda Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fe5eedda Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fe5eedda Branch: refs/heads/master Commit: fe5eedda59947924259ec3ce801f6905b9c5a010 Parents: 26aaa59 Author: Kyle Lape Authored: Sun Feb 8 18:52:46 2015 -0800 Committer: Daniel Kulp Committed: Tue Feb 10 16:51:25 2015 -0500 -- .../cxf/bus/extension/ExtensionManagerBus.java | 29 ++-- 1 file changed, 21 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/fe5eedda/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 0478279..909ed8a 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 @@ -61,19 +61,28 @@ 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 { -b = Boolean.getBoolean("org.apache.cxf.logging.enabled"); -//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"); +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"; @@ -102,7 +111,9 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem CXFBusFactory.possiblySetDefaultBus(this); if (FORCE_LOGGING) { -features.add(new LoggingFeature()); +LoggingFeature feature = new LoggingFeature(); +feature.setPrettyLogging(FORCE_PRETTY); +features.add(feature); } if (null == properties) { properties = new HashMap(); @@ -345,7 +356,9 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider implem this.features.clear(); this.features.addAll(features); if (FORCE_LOGGING) { -this.features.add(new LoggingFeature()); +LoggingFeature feature = new LoggingFeature(); +feature.setPrettyLogging(FORCE_PRETTY); +this.features.add(feature); } if (state == BusState.RUNNING) { initializeFeatures();