annotate src/org/eclipse/jetty/server/NCSARequestLog.java @ 823:9d4eab790cd2

remove ServletRequestHttpWrapper and ServletResponseHttpWrapper
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 14 Sep 2016 01:05:27 -0600
parents 8e9db0bbf4f9
children 2afcb04f56a4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 package org.eclipse.jetty.server;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 import java.io.OutputStream;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import java.io.OutputStreamWriter;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import java.io.Writer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 import java.util.Locale;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import java.util.TimeZone;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 import javax.servlet.http.Cookie;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 import org.eclipse.jetty.http.HttpHeaders;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 import org.eclipse.jetty.http.PathMap;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 import org.eclipse.jetty.util.DateCache;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 import org.eclipse.jetty.util.RolloverFileOutputStream;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 import org.eclipse.jetty.util.StringUtil;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 import org.eclipse.jetty.util.component.AbstractLifeCycle;
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
36 import org.slf4j.Logger;
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
37 import org.slf4j.LoggerFactory;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 /**
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 * This {@link RequestLog} implementation outputs logs in the pseudo-standard
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 * NCSA common log format. Configuration options allow a choice between the
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 * standard Common Log Format (as used in the 3 log format) and the Combined Log
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 * Format (single log format). This log format can be output by most web
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 * servers, and almost all web log analysis software can understand these
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 * formats.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 * @org.apache.xbean.XBean element="ncsaLog"
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 /* ------------------------------------------------------------ */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 /**
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54 {
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
55 private static final Logger LOG = LoggerFactory.getLogger(NCSARequestLog.class);
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
56 private static ThreadLocal<StringBuilder> _buffers = new ThreadLocal<StringBuilder>()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
57 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
58 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
59 protected StringBuilder initialValue()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
60 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
61 return new StringBuilder(256);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
62 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
63 };
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
64
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
65 private String _filename;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
66 private boolean _extended;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
67 private boolean _append;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
68 private int _retainDays;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
69 private boolean _closeOut;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
70 private boolean _preferProxiedForAddress;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
71 private String _logDateFormat = "dd/MMM/yyyy:HH:mm:ss Z";
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
72 private String _filenameDateFormat = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
73 private Locale _logLocale = Locale.getDefault();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
74 private String _logTimeZone = "GMT";
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
75 private String[] _ignorePaths;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
76 private boolean _logLatency = false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
77 private boolean _logCookies = false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
78 private boolean _logServer = false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
79 private boolean _logDispatch = false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
80
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
81 private transient OutputStream _out;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
82 private transient OutputStream _fileOut;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
83 private transient DateCache _logDateCache;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
84 private transient PathMap _ignorePathMap;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
85 private transient Writer _writer;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
86
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
87 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
88 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
89 * Create request log object with default settings.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
90 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
91 public NCSARequestLog()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
92 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
93 _extended = true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
94 _append = true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
95 _retainDays = 31;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
96 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
97
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
98 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
99 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
100 * Create request log object with specified output file name.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
101 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
102 * @param filename the file name for the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
103 * This may be in the format expected
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
104 * by {@link RolloverFileOutputStream}
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
105 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
106 public NCSARequestLog(String filename)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
107 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
108 _extended = true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
109 _append = true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
110 _retainDays = 31;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
111 setFilename(filename);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
112 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
113
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
114 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
115 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
116 * Set the output file name of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
117 * The file name may be in the format expected by
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
118 * {@link RolloverFileOutputStream}.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
119 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
120 * @param filename file name of the request log
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
121 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
122 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
123 public void setFilename(String filename)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
124 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
125 if (filename != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
126 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
127 filename = filename.trim();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
128 if (filename.length() == 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
129 filename = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
130 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
131 _filename = filename;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
132 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
133
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
134 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
135 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
136 * Retrieve the output file name of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
137 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
138 * @return file name of the request log
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
139 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
140 public String getFilename()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
141 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
142 return _filename;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
143 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
144
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
145 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
146 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
147 * Retrieve the file name of the request log with the expanded
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
148 * date wildcard if the output is written to the disk using
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
149 * {@link RolloverFileOutputStream}.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
150 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
151 * @return file name of the request log, or null if not applicable
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
152 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
153 public String getDatedFilename()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
154 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
155 if (_fileOut instanceof RolloverFileOutputStream)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
156 return ((RolloverFileOutputStream)_fileOut).getDatedFilename();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
157 return null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
158 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
159
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
160 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
161 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
162 * Set the timestamp format for request log entries in the file.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
163 * If this is not set, the pre-formated request timestamp is used.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
164 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
165 * @param format timestamp format string
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
166 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
167 public void setLogDateFormat(String format)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
168 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
169 _logDateFormat = format;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
170 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
171
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
172 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
173 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
174 * Retrieve the timestamp format string for request log entries.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
175 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
176 * @return timestamp format string.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
177 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
178 public String getLogDateFormat()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
179 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
180 return _logDateFormat;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
181 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
182
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
183 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
184 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
185 * Set the locale of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
186 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
187 * @param logLocale locale object
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
188 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
189 public void setLogLocale(Locale logLocale)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
190 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
191 _logLocale = logLocale;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
192 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
193
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
194 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
195 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
196 * Retrieve the locale of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
197 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
198 * @return locale object
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
199 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
200 public Locale getLogLocale()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
201 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
202 return _logLocale;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
203 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
204
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
205 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
206 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
207 * Set the timezone of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
208 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
209 * @param tz timezone string
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
210 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
211 public void setLogTimeZone(String tz)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
212 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
213 _logTimeZone = tz;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
214 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
215
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
216 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
217 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
218 * Retrieve the timezone of the request log.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
219 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
220 * @return timezone string
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
221 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
222 public String getLogTimeZone()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
223 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
224 return _logTimeZone;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
225 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
226
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
227 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
228 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
229 * Set the number of days before rotated log files are deleted.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
230 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
231 * @param retainDays number of days to keep a log file
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
232 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
233 public void setRetainDays(int retainDays)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
234 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
235 _retainDays = retainDays;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
236 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
237
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
238 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
239 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
240 * Retrieve the number of days before rotated log files are deleted.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
241 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
242 * @return number of days to keep a log file
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
243 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
244 public int getRetainDays()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
245 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
246 return _retainDays;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
247 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
248
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
249 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
250 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
251 * Set the extended request log format flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
252 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
253 * @param extended true - log the extended request information,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
254 * false - do not log the extended request information
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
255 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
256 public void setExtended(boolean extended)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
257 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
258 _extended = extended;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
259 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
260
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
261 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
262 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
263 * Retrieve the extended request log format flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
264 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
265 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
266 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
267 public boolean isExtended()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
268 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
269 return _extended;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
270 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
271
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
272 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
273 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
274 * Set append to log flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
275 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
276 * @param append true - request log file will be appended after restart,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
277 * false - request log file will be overwritten after restart
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
278 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
279 public void setAppend(boolean append)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
280 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
281 _append = append;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
282 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
283
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
284 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
285 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
286 * Retrieve append to log flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
287 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
288 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
289 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
290 public boolean isAppend()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
291 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
292 return _append;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
293 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
294
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
295 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
296 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
297 * Set request paths that will not be logged.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
298 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
299 * @param ignorePaths array of request paths
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
300 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
301 public void setIgnorePaths(String[] ignorePaths)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
302 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
303 _ignorePaths = ignorePaths;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
304 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
305
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
306 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
307 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
308 * Retrieve the request paths that will not be logged.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
309 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
310 * @return array of request paths
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
311 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
312 public String[] getIgnorePaths()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
313 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
314 return _ignorePaths;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
315 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
316
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
317 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
318 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
319 * Controls logging of the request cookies.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
320 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
321 * @param logCookies true - values of request cookies will be logged,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
322 * false - values of request cookies will not be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
323 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
324 public void setLogCookies(boolean logCookies)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
325 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
326 _logCookies = logCookies;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
327 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
328
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
329 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
330 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
331 * Retrieve log cookies flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
332 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
333 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
334 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
335 public boolean getLogCookies()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
336 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
337 return _logCookies;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
338 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
339
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
340 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
341 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
342 * Controls logging of the request hostname.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
343 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
344 * @param logServer true - request hostname will be logged,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
345 * false - request hostname will not be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
346 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
347 public void setLogServer(boolean logServer)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
348 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
349 _logServer = logServer;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
350 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
351
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
352 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
353 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
354 * Retrieve log hostname flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
355 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
356 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
357 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
358 public boolean getLogServer()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
359 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
360 return _logServer;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
361 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
362
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
363 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
364 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
365 * Controls logging of request processing time.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
366 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
367 * @param logLatency true - request processing time will be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
368 * false - request processing time will not be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
369 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
370 public void setLogLatency(boolean logLatency)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
371 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
372 _logLatency = logLatency;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
373 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
374
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
375 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
376 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
377 * Retrieve log request processing time flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
378 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
379 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
380 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
381 public boolean getLogLatency()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
382 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
383 return _logLatency;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
384 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
385
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
386 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
387 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
388 * Controls whether the actual IP address of the connection or
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
389 * the IP address from the X-Forwarded-For header will be logged.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
390 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
391 * @param preferProxiedForAddress true - IP address from header will be logged,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
392 * false - IP address from the connection will be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
393 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
394 public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
395 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
396 _preferProxiedForAddress = preferProxiedForAddress;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
397 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
398
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
399 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
400 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
401 * Retrieved log X-Forwarded-For IP address flag.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
402 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
403 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
404 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
405 public boolean getPreferProxiedForAddress()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
406 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
407 return _preferProxiedForAddress;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
408 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
409
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
410 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
411 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
412 * Set the log file name date format.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
413 * @see RolloverFileOutputStream#RolloverFileOutputStream(String, boolean, int, TimeZone, String, String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
414 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
415 * @param logFileDateFormat format string that is passed to {@link RolloverFileOutputStream}
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
416 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
417 public void setFilenameDateFormat(String logFileDateFormat)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
418 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
419 _filenameDateFormat = logFileDateFormat;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
420 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
421
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
422 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
423 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
424 * Retrieve the file name date format string.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
425 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
426 * @return the log File Date Format
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
427 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
428 public String getFilenameDateFormat()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
429 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
430 return _filenameDateFormat;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
431 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
432
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
433 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
434 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
435 * Controls logging of the request dispatch time
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
436 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
437 * @param value true - request dispatch time will be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
438 * false - request dispatch time will not be logged
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
439 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
440 public void setLogDispatch(boolean value)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
441 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
442 _logDispatch = value;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
443 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
444
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
445 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
446 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
447 * Retrieve request dispatch time logging flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
448 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
449 * @return value of the flag
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
450 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
451 public boolean isLogDispatch()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
452 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
453 return _logDispatch;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
454 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
455
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
456 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
457 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
458 * Writes the request and response information to the output stream.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
459 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
460 * @see org.eclipse.jetty.server.RequestLog#log(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
461 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
462 public void log(Request request, Response response)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
463 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
464 try
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
465 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
466 if (_ignorePathMap != null && _ignorePathMap.getMatch(request.getRequestURI()) != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
467 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
468
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
469 if (_fileOut == null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
470 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
471
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
472 StringBuilder buf= _buffers.get();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
473 buf.setLength(0);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
474
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
475 if (_logServer)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
476 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
477 buf.append(request.getServerName());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
478 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
479 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
480
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
481 String addr = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
482 if (_preferProxiedForAddress)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
483 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
484 addr = request.getHeader(HttpHeaders.X_FORWARDED_FOR);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
485 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
486
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
487 if (addr == null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
488 addr = request.getRemoteAddr();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
489
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
490 buf.append(addr);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
491 buf.append(" - ");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
492
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
493 buf.append(" [");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
494 if (_logDateCache != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
495 buf.append(_logDateCache.format(request.getTimeStamp()));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
496 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
497 buf.append(request.getTimeStampBuffer().toString());
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
498
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
499 buf.append("] \"");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
500 buf.append(request.getMethod());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
501 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
502 buf.append(request.getUri().toString());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
503 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
504 buf.append(request.getProtocol());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
505 buf.append("\" ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
506 if (request.getAsyncContinuation().isInitial())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
507 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
508 int status = response.getStatus();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
509 if (status <= 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
510 status = 404;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
511 buf.append((char)('0' + ((status / 100) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
512 buf.append((char)('0' + ((status / 10) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
513 buf.append((char)('0' + (status % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
514 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
515 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
516 buf.append("Async");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
517
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
518 long responseLength = response.getContentCount();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
519 if (responseLength >= 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
520 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
521 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
522 if (responseLength > 99999)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
523 buf.append(responseLength);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
524 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
525 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
526 if (responseLength > 9999)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
527 buf.append((char)('0' + ((responseLength / 10000) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
528 if (responseLength > 999)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
529 buf.append((char)('0' + ((responseLength / 1000) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
530 if (responseLength > 99)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
531 buf.append((char)('0' + ((responseLength / 100) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
532 if (responseLength > 9)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
533 buf.append((char)('0' + ((responseLength / 10) % 10)));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
534 buf.append((char)('0' + (responseLength) % 10));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
535 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
536 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
537 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
538 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
539 buf.append(" - ");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
540
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
541
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
542 if (_extended)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
543 logExtended(request, response, buf);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
544
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
545 if (_logCookies)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
546 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
547 Cookie[] cookies = request.getCookies();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
548 if (cookies == null || cookies.length == 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
549 buf.append(" -");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
550 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
551 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
552 buf.append(" \"");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
553 for (int i = 0; i < cookies.length; i++)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
554 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
555 if (i != 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
556 buf.append(';');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
557 buf.append(cookies[i].getName());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
558 buf.append('=');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
559 buf.append(cookies[i].getValue());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
560 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
561 buf.append('\"');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
562 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
563 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
564
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
565 if (_logDispatch || _logLatency)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
566 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
567 long now = System.currentTimeMillis();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
568
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
569 if (_logDispatch)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
570 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
571 long d = request.getDispatchTime();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
572 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
573 buf.append(now - (d==0 ? request.getTimeStamp():d));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
574 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
575
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
576 if (_logLatency)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
577 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
578 buf.append(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
579 buf.append(now - request.getTimeStamp());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
580 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
581 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
582
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
583 buf.append(StringUtil.__LINE_SEPARATOR);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
584
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
585 String log = buf.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
586 write(log);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
587 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
588 catch (IOException e)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
589 {
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
590 LOG.warn("",e);
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
591 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
592 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
593
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
594 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
595 protected void write(String log) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
596 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
597 synchronized(this)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
598 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
599 if (_writer==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
600 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
601 _writer.write(log);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
602 _writer.flush();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
603 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
604 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
605
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
606
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
607 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
608 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
609 * Writes extended request and response information to the output stream.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
610 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
611 * @param request request object
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
612 * @param response response object
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
613 * @param b StringBuilder to write to
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
614 * @throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
615 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
616 protected void logExtended(Request request,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
617 Response response,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
618 StringBuilder b) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
619 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
620 String referer = request.getHeader(HttpHeaders.REFERER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
621 if (referer == null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
622 b.append("\"-\" ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
623 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
624 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
625 b.append('"');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
626 b.append(referer);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
627 b.append("\" ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
628 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
629
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
630 String agent = request.getHeader(HttpHeaders.USER_AGENT);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
631 if (agent == null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
632 b.append("\"-\" ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
633 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
634 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
635 b.append('"');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
636 b.append(agent);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
637 b.append('"');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
638 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
639 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
640
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
641 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
642 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
643 * Set up request logging and open log file.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
644 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
645 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
646 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
647 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
648 protected synchronized void doStart() throws Exception
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
649 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
650 if (_logDateFormat != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
651 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
652 _logDateCache = new DateCache(_logDateFormat,_logLocale);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
653 _logDateCache.setTimeZoneID(_logTimeZone);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
654 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
655
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
656 if (_filename != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
657 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
658 _fileOut = new RolloverFileOutputStream(_filename,_append,_retainDays,TimeZone.getTimeZone(_logTimeZone),_filenameDateFormat,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
659 _closeOut = true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
660 LOG.info("Opened " + getDatedFilename());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
661 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
662 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
663 _fileOut = System.err;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
664
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
665 _out = _fileOut;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
666
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
667 if (_ignorePaths != null && _ignorePaths.length > 0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
668 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
669 _ignorePathMap = new PathMap();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
670 for (int i = 0; i < _ignorePaths.length; i++)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
671 _ignorePathMap.put(_ignorePaths[i],_ignorePaths[i]);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
672 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
673 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
674 _ignorePathMap = null;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
675
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
676 synchronized(this)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
677 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
678 _writer = new OutputStreamWriter(_out);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
679 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
680 super.doStart();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
681 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
682
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
683 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
684 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
685 * Close the log file and perform cleanup.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
686 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
687 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
688 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
689 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
690 protected void doStop() throws Exception
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
691 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
692 synchronized (this)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
693 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
694 super.doStop();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
695 try
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
696 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
697 if (_writer != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
698 _writer.flush();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
699 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
700 catch (IOException e)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
701 {
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
702 LOG.trace("",e);
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
703 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
704 if (_out != null && _closeOut)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
705 try
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
706 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
707 _out.close();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
708 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
709 catch (IOException e)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
710 {
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 815
diff changeset
711 LOG.trace("",e);
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
712 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
713
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
714 _out = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
715 _fileOut = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
716 _closeOut = false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
717 _logDateCache = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
718 _writer = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
719 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
720 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
721 }