close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": libgmp.so.10: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Jul 4, 2008, 4:40:19 PM (18 years ago)
- Author:
-
waue
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
|
v3
|
v4
|
|
| 12 | 12 | |
| 13 | 13 | * 3. you should filter the exception contents manually, |
| 14 | | {{{ ex: ::1 - - [29/Jun/2008:07:35:15 +0800] "GET / HTTP/1.0" 200 729 "... |
| 15 | | }}} |
| | 14 | {{{ |
| | 15 | ex: ::1 - - [29/Jun/2008:07:35:15 +0800] "GET / HTTP/1.0" 200 729 "... |
| 16 | 16 | }}} |
| 17 | 17 | = 結果 = |
| … |
… |
|
| 81 | 81 | import java.util.regex.Pattern; |
| 82 | 82 | |
| 83 | | |
| 84 | | |
| 85 | | |
| 86 | 83 | public class LogParser { |
| 87 | 84 | |
| … |
… |
|
| 104 | 101 | private long timestamp; |
| 105 | 102 | |
| 106 | | |
| 107 | 103 | private static Pattern p = Pattern |
| 108 | 104 | |
| … |
… |
|
| 111 | 107 | " ([^ ]*) ([^ ]*) \"([^\"]*)\" \"([^\"]*)\".*"); |
| 112 | 108 | |
| 113 | | public LogParser(String line) throws ParseException, Exception{ |
| | 109 | public LogParser(String line) throws ParseException, Exception{ |
| 114 | 110 | |
| 115 | 111 | Matcher matcher = p.matcher(line); |
| … |
… |
|
| 147 | 143 | } |
| 148 | 144 | |
| 149 | | |
| 150 | | |
| 151 | | } |
| 152 | | |
| | 145 | } |
| 153 | 146 | |
| 154 | 147 | public static boolean isIpAddress(String inputString) { |
| … |
… |
|
| 194 | 187 | } |
| 195 | 188 | |
| 196 | | |
| 197 | | |
| 198 | 189 | public String getIp() { |
| 199 | 190 | |
| … |
… |
|
| 202 | 193 | } |
| 203 | 194 | |
| 204 | | |
| 205 | | |
| 206 | 195 | public String getProtocol() { |
| 207 | 196 | |
| … |
… |
|
| 210 | 199 | } |
| 211 | 200 | |
| 212 | | |
| 213 | | |
| 214 | 201 | public String getMethod() { |
| 215 | 202 | |
| … |
… |
|
| 218 | 205 | } |
| 219 | 206 | |
| 220 | | |
| 221 | | |
| 222 | 207 | public String getUrl() { |
| 223 | 208 | |
| … |
… |
|
| 226 | 211 | } |
| 227 | 212 | |
| 228 | | |
| 229 | | |
| 230 | 213 | public String getCode() { |
| 231 | 214 | |
| … |
… |
|
| 234 | 217 | } |
| 235 | 218 | |
| 236 | | |
| 237 | | |
| 238 | 219 | public String getByteSize() { |
| 239 | 220 | |
| … |
… |
|
| 242 | 223 | } |
| 243 | 224 | |
| 244 | | |
| 245 | | |
| 246 | 225 | public String getReferrer() { |
| 247 | 226 | |
| … |
… |
|
| 250 | 229 | } |
| 251 | 230 | |
| 252 | | |
| 253 | | |
| 254 | 231 | public String getAgent() { |
| 255 | 232 | |
| … |
… |
|
| 258 | 235 | } |
| 259 | 236 | |
| 260 | | |
| 261 | | |
| 262 | 237 | public long getTimestamp() { |
| 263 | 238 | |