From 29199b507f80b88f98dfee74bb508b37926c7cda Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 13 May 2013 10:05:29 +0000
Subject: [PATCH] OPENDJ-902 (CR-1654) Add connectionID to the HTTP access log + move to extended log format

---
 opends/src/server/org/opends/server/loggers/HTTPRequestInfo.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/loggers/HTTPRequestInfo.java b/opends/src/server/org/opends/server/loggers/HTTPRequestInfo.java
index e9867bb..5a18a7c 100644
--- a/opends/src/server/org/opends/server/loggers/HTTPRequestInfo.java
+++ b/opends/src/server/org/opends/server/loggers/HTTPRequestInfo.java
@@ -56,14 +56,22 @@
    * was set since it is not .
    */
   private AtomicInteger statusCode = new AtomicInteger(0);
+  /**
+   * The unique identifier that has been assigned to the client connection for
+   * this HTTP request.
+   */
+  private long connectionID;
 
   /**
    * Constructor for this class.
    *
    * @param request
    *          The {@link HttpServletRequest} for which to log the information
+   * @param connectionID
+   *          The unique identifier that has been assigned to the client
+   *          connection for this HTTP request
    */
-  public HTTPRequestInfo(HttpServletRequest request)
+  public HTTPRequestInfo(HttpServletRequest request, long connectionID)
   {
     this.remoteHost = request.getRemoteHost();
     this.remoteAddress = request.getRemoteAddr();
@@ -71,6 +79,7 @@
     this.query = request.getRequestURI() + "/" + request.getQueryString();
     this.protocol = request.getProtocol();
     this.userAgent = request.getHeader("User-Agent");
+    this.connectionID = connectionID;
   }
 
   /**
@@ -166,6 +175,18 @@
   }
 
   /**
+   * Returns the unique identifier that has been assigned to the client
+   * connection for this HTTP request.
+   *
+   * @return The unique identifier that has been assigned to the client
+   *         connection for this HTTP request
+   */
+  public long getConnectionID()
+  {
+    return this.connectionID;
+  }
+
+  /**
    * Logs the current request info in the HTTP access log.
    *
    * @param statusCode

--
Gitblit v1.10.0