cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r760150 - in /cxf/trunk: maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ rt/core/src/main/java/org/apache/cxf/interceptor/
Date Mon, 30 Mar 2009 20:21:31 GMT
Author: dkulp
Date: Mon Mar 30 20:21:31 2009
New Revision: 760150

URL: http://svn.apache.org/viewvc?rev=760150&view=rev
Log:
Throw an ID into the logging stuff to make it easier to correlate the request/response in
the logs
Also throw the incoming URI on server side to know which service it's going to

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingMessage.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java?rev=760150&r1=760149&r2=760150&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
Mon Mar 30 20:21:31 2009
@@ -29,11 +29,6 @@
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 
-/**
-   This class was ported from fAnt wsdl2java task
-   http://code.google.com/p/fant/
- */
-
 public final class WsdlOptionLoader {
     private static final String WSDL_OPTIONS = "-options$";
     private static final String WSDL_BINDINGS = "-binding-?\\d*.xml$";

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=760150&r1=760149&r2=760150&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Mon
Mar 30 20:21:31 2009
@@ -84,7 +84,13 @@
     }
 
     private void logging(Message message) throws Fault {
-        final LoggingMessage buffer = new LoggingMessage("Inbound Message\n----------------------------");
+        String id = (String)message.getExchange().get(LoggingMessage.ID_KEY);
+        if (id == null) {
+            id = LoggingMessage.nextId();
+            message.getExchange().put(LoggingMessage.ID_KEY, id);
+        }
+        final LoggingMessage buffer 
+            = new LoggingMessage("Inbound Message\n----------------------------", id);
 
         
         String encoding = (String)message.get(Message.ENCODING);
@@ -101,6 +107,10 @@
         if (headers != null) {
             buffer.getHeader().append(headers);
         }
+        String uri = (String)message.get(Message.REQUEST_URI);
+        if (uri != null) {
+            buffer.getAddress().append(uri);
+        }
             
         InputStream is = message.getContent(InputStream.class);
         if (is != null) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingMessage.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingMessage.java?rev=760150&r1=760149&r2=760150&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingMessage.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingMessage.java Mon Mar
30 20:21:31 2009
@@ -18,8 +18,12 @@
  */
 package org.apache.cxf.interceptor;
 
-public final class LoggingMessage {
+import java.util.concurrent.atomic.AtomicInteger;
 
+public final class LoggingMessage {
+    public static final String ID_KEY = LoggingMessage.class.getName() + ".ID";
+    private static final AtomicInteger ID = new AtomicInteger();
+    
     private final String heading;
     private final StringBuilder address;
     private final StringBuilder contentType;
@@ -27,9 +31,12 @@
     private final StringBuilder header;
     private final StringBuilder message;
     private final StringBuilder payload;
+    private final String id;
+    
 
-    public LoggingMessage(String h) {
+    public LoggingMessage(String h, String i) {
         heading = h;
+        id = i;
 
         contentType = new StringBuilder();
         address = new StringBuilder();
@@ -38,6 +45,12 @@
         message = new StringBuilder();
         payload = new StringBuilder();
     }
+    
+    public static String nextId() {
+        return Integer.toString(ID.incrementAndGet());
+    }
+        
+    
     public StringBuilder getAddress() {
         return address;
     }
@@ -65,6 +78,7 @@
     public String toString() {
         StringBuilder buffer = new StringBuilder();
         buffer.append(heading);
+        buffer.append("\nID: ").append(id);
         if (address.length() > 0) {
             buffer.append("\nAddress: ");
             buffer.append(address);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=760150&r1=760149&r2=760150&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
Mon Mar 30 20:21:31 2009
@@ -108,7 +108,14 @@
         }
         
         public void onClose(CachedOutputStream cos) {
-            final LoggingMessage buffer = new LoggingMessage("Outbound Message\n---------------------------");
+            String id = (String)message.getExchange().get(LoggingMessage.ID_KEY);
+            if (id == null) {
+                id = LoggingMessage.nextId();
+                message.getExchange().put(LoggingMessage.ID_KEY, id);
+            }
+            final LoggingMessage buffer 
+                = new LoggingMessage("Outbound Message\n---------------------------",
+                                     id);
             
             String encoding = (String)message.get(Message.ENCODING);
 



Mime
View raw message