@@ -38,18 +38,11 @@ public class ACSRequestLog extends NCSARequestLog {
3838 private static final ThreadLocal <StringBuilder > buffers =
3939 ThreadLocal .withInitial (() -> new StringBuilder (256 ));
4040
41- private static final String MY_URL = "/client/api/**" ;
42-
43- private final PathPattern pattern ;
44-
4541 private final DateCache dateCache ;
4642
4743 public ACSRequestLog () {
4844 super ();
4945
50- PathPatternParser pp = new PathPatternParser ();
51- pattern = pp .parse (MY_URL );
52-
5346 TimeZone timeZone = TimeZone .getTimeZone ("GMT" );
5447 Locale locale = Locale .getDefault ();
5548 dateCache = new DateCache (DEFAULT_DATE_FORMAT , locale , timeZone );
@@ -58,37 +51,34 @@ public ACSRequestLog() {
5851 @ Override
5952 public void log (Request request , Response response ) {
6053 String requestURI = StringUtils .cleanString (request .getRequestURI ());
61- if (RequestMethod .GET .name ().equals (request .getMethod ()) &&
62- pattern .matches (PathContainer .parsePath (requestURI ))) {
63- try {
64- StringBuilder sb = buffers .get ();
65- sb .setLength (0 );
54+ String parameters = StringUtils .cleanString (String .valueOf (request .getQueryParameters ()));
55+ try {
56+ StringBuilder sb = buffers .get ();
57+ sb .setLength (0 );
6658
67- sb .append (request .getHttpChannel ().getEndPoint ()
68- .getRemoteAddress ().getAddress ()
69- .getHostAddress ())
70- .append (" - - [" )
71- .append (dateCache .format (request .getTimeStamp ()))
72- .append ("] \" " )
73- .append (request .getMethod ())
74- .append (" " )
75- .append (requestURI )
76- .append (" " )
77- .append (request .getProtocol ())
78- .append ("\" " )
79- .append (response .getStatus ())
80- .append (" " )
81- .append (response .getHttpChannel ().getBytesWritten ()) // apply filter here?
82- .append (" \" -\" \" " )
83- .append (request .getHeader ("User-Agent" ))
84- .append ("\" " );
59+ sb .append (request .getHttpChannel ().getEndPoint ()
60+ .getRemoteAddress ().getAddress ()
61+ .getHostAddress ())
62+ .append (" - - [" )
63+ .append (dateCache .format (request .getTimeStamp ()))
64+ .append ("] \" " )
65+ .append (request .getMethod ())
66+ .append (" " )
67+ .append (requestURI )
68+ .append (parameters )
69+ .append (" " )
70+ .append (request .getProtocol ())
71+ .append ("\" " )
72+ .append (response .getStatus ())
73+ .append (" " )
74+ .append (response .getHttpChannel ().getBytesWritten ()) // apply filter here?
75+ .append (" \" -\" \" " )
76+ .append (request .getHeader ("User-Agent" ))
77+ .append ("\" " );
8578
86- write (sb .toString ());
87- } catch (Exception e ) {
88- LOG .warn ("Unable to log request" , e );
89- }
90- } else {
91- super .log (request , response );
79+ write (sb .toString ());
80+ } catch (Exception e ) {
81+ LOG .warn ("Unable to log request" , e );
9282 }
9383 }
9484
0 commit comments