tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers AccessLogInterceptor.java
Date Sun, 26 Oct 2003 01:19:13 GMT
billbarker    2003/10/25 18:19:13

  Modified:    src/share/org/apache/tomcat/modules/loggers
                        AccessLogInterceptor.java
  Log:
  Change logging to an event that always gets fired.
  
  Also log the bytes recieved for PUT.
  
  Fix for Bug #24123
  Summitted by:  Michael Lemke lemkemch@t-online.de
  
  Revision  Changes    Path
  1.12      +9 -4      jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers/AccessLogInterceptor.java
  
  Index: AccessLogInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/loggers/AccessLogInterceptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AccessLogInterceptor.java	29 Sep 2003 07:41:50 -0000	1.11
  +++ AccessLogInterceptor.java	26 Oct 2003 01:19:13 -0000	1.12
  @@ -189,7 +189,7 @@
       
       /** <p>This method is actually creating an entry in the log file.</p>
        */
  -    public int beforeCommit(Request request, Response response) {
  +    public int postRequest(Request request, Response response) {
   	synchronized (AccessLogInterceptor.class) {
   	    FileWriter fw = getFileWriter();
   	    if (fw != null) {
  @@ -242,9 +242,14 @@
   				fw.write(request.protocol().toString().trim());
   				break;
   			    case 'b':
  -				String cl = response.getMimeHeaders().
  -				                   getHeader("Content-Length");
  -				if(cl != null) {
  +				String cl;
  +				if(response.getStatus() == 201) {
  +				    cl = request.getHeader("Content-Length");
  +				} else {
  +				    cl = response.getMimeHeaders().
  +					getHeader("Content-Length");
  +				}
  +				if(cl != null && !"0".equals(cl)) {
   				    fw.write(cl);
   				} else {
   				    fw.write("-");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message