3030import javax .servlet .http .HttpServlet ;
3131import javax .servlet .http .HttpServletRequest ;
3232import javax .servlet .http .HttpServletResponse ;
33+ import org .eclipse .jetty .io .EofException ;
3334import org .eclipse .jetty .websocket .api .WebSocketBehavior ;
3435import org .eclipse .jetty .websocket .api .WebSocketPolicy ;
3536import org .eclipse .jetty .websocket .server .WebSocketServerFactory ;
@@ -448,8 +449,11 @@ protected void logRequestInfo(HttpServletRequest req, Throwable error)
448449 if (req .getQueryString () != null )
449450 query = "?" + req .getQueryString ();
450451
451- if (error != null )
452- log .error (INTERNAL_ERROR_LOG_MSG , method , url , query , ip , user , error );
452+ if (error != null ) {
453+ // log EofException (closed by client) only if trace level is enabled
454+ if (!(error instanceof EofException ) || log .isTraceEnabled ())
455+ log .error (INTERNAL_ERROR_LOG_MSG , method , url , query , ip , user , error );
456+ }
453457 else
454458 log .info (LOG_REQUEST_MSG , method , url , query , ip , user );
455459 }
@@ -485,7 +489,8 @@ public void sendError(int code, String msg, HttpServletRequest req, HttpServletR
485489 }
486490 catch (IOException e )
487491 {
488- log .error ("Could not send error response" , e );
492+ if (getLogger ().isTraceEnabled ())
493+ log .error ("Could not send error response" , e );
489494 }
490495 }
491496
@@ -528,7 +533,7 @@ protected void handleAuthException(HttpServletRequest req, HttpServletResponse r
528533 {
529534 try
530535 {
531- log .debug ("Not authorized: {}" , e .getMessage ());
536+ log .warn ("Not authorized: {}" , e .getMessage ());
532537
533538 if (req != null && resp != null )
534539 {
@@ -540,7 +545,8 @@ protected void handleAuthException(HttpServletRequest req, HttpServletResponse r
540545 }
541546 catch (Exception e1 )
542547 {
543- getLogger ().error ("Could not send authentication request" , e1 );
548+ if (getLogger ().isTraceEnabled ())
549+ getLogger ().error ("Could not send authentication request" , e1 );
544550 }
545551 }
546552
0 commit comments