Skip to content

Instantly share code, notes, and snippets.

@jamesdube
Forked from NutterzUK/Logging filter
Created July 22, 2021 23:15
Show Gist options
  • Save jamesdube/0f339cf8775298aeed801a7f3aff3d9b to your computer and use it in GitHub Desktop.
Save jamesdube/0f339cf8775298aeed801a7f3aff3d9b to your computer and use it in GitHub Desktop.
@Component
public class LogFilter extends OncePerRequestFilter {
private static Logger LOG = LoggerFactory.getLogger(LogFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
LOG.info(request.getRequestURI()); // log the request path.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment