Author: dkulp
Date: Tue Aug 9 20:22:14 2011
New Revision: 1155547
URL: http://svn.apache.org/viewvc?rev=1155547&view=rev
Log:
Merged revisions 1155543 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1155543 | dkulp | 2011-08-09 16:18:07 -0400 (Tue, 09 Aug 2011) | 2 lines
[CXF-3726] Add pretty flags for LoggingFeature and Logging annotation
Promote getFeatures method to Bus interface
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/annotations/Logging.java
cxf/branches/2.4.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/Bus.java?rev=1155547&r1=1155546&r2=1155547&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/Bus.java
(original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/Bus.java Tue Aug
9 20:22:14 2011
@@ -19,8 +19,10 @@
package org.apache.cxf;
+import java.util.Collection;
import java.util.Map;
+import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.interceptor.InterceptorProvider;
/**
@@ -46,5 +48,7 @@ public interface Bus extends Interceptor
void setProperty(String s, Object o);
Object getProperty(String s);
Map<String, Object> getProperties();
-
+
+
+ Collection<AbstractFeature> getFeatures();
}
Modified:
cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/annotations/Logging.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/annotations/Logging.java?rev=1155547&r1=1155546&r2=1155547&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/annotations/Logging.java
(original)
+++
cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/annotations/Logging.java
Tue Aug 9 20:22:14 2011
@@ -44,5 +44,12 @@ public @interface Logging {
*/
String inLocation() default "<logger>";
String outLocation() default "<logger>";
+
+
+ /**
+ * For XML content, turn on pretty printing in the logs
+ * @return
+ */
+ boolean pretty() default false;
}
Modified:
cxf/branches/2.4.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java?rev=1155547&r1=1155546&r2=1155547&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
(original)
+++
cxf/branches/2.4.x-fixes/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
Tue Aug 9 20:22:14 2011
@@ -20,6 +20,7 @@ package org.apache.cxf.jca.cxf.test;
+import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.ResourceBundle;
@@ -27,6 +28,7 @@ import java.util.ResourceBundle;
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
import org.apache.cxf.service.model.AbstractPropertiesHolder;
@@ -135,4 +137,10 @@ public class DummyBus extends AbstractBa
public void setProperty(String s, Object o) {
}
+
+ public Collection<AbstractFeature> getFeatures() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified:
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java?rev=1155547&r1=1155546&r2=1155547&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java
Tue Aug 9 20:22:14 2011
@@ -49,6 +49,7 @@ public class LoggingFeature extends Abst
String inLocation;
String outLocation;
+ boolean prettyLogging;
int limit = DEFAULT_LIMIT;
@@ -68,15 +69,24 @@ public class LoggingFeature extends Abst
limit = lim;
}
+ public LoggingFeature(String in, String out, int lim, boolean p) {
+ inLocation = in;
+ outLocation = out;
+ limit = lim;
+ prettyLogging = p;
+ }
+
public LoggingFeature(Logging annotation) {
inLocation = annotation.inLocation();
outLocation = annotation.outLocation();
limit = annotation.limit();
+ prettyLogging = annotation.pretty();
}
@Override
protected void initializeProvider(InterceptorProvider provider, Bus bus) {
- if (limit == DEFAULT_LIMIT && inLocation == null && outLocation ==
null) {
+ if (limit == DEFAULT_LIMIT && inLocation == null
+ && outLocation == null && !prettyLogging) {
provider.getInInterceptors().add(IN);
provider.getInFaultInterceptors().add(IN);
provider.getOutInterceptors().add(OUT);
@@ -84,8 +94,10 @@ public class LoggingFeature extends Abst
} else {
LoggingInInterceptor in = new LoggingInInterceptor(limit);
in.setOutputLocation(inLocation);
+ in.setPrettyLogging(prettyLogging);
LoggingOutInterceptor out = new LoggingOutInterceptor(limit);
out.setOutputLocation(outLocation);
+ out.setPrettyLogging(prettyLogging);
provider.getInInterceptors().add(in);
provider.getInFaultInterceptors().add(in);
@@ -108,5 +120,19 @@ public class LoggingFeature extends Abst
*/
public int getLimit() {
return limit;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isPrettyLogging() {
+ return prettyLogging;
+ }
+ /**
+ * Turn pretty logging of XML content on/off
+ * @param prettyLogging
+ */
+ public void setPrettyLogging(boolean prettyLogging) {
+ this.prettyLogging = prettyLogging;
}
}