org.apache.logging.log4j.web

Class Log4jServletFilter

  • All Implemented Interfaces:
    javax.servlet.Filter


    public class Log4jServletFilter
    extends Object
    implements javax.servlet.Filter
    This is responsible for the following:
    • Clearing the logger context when the application has finished starting up.
    • Setting the logger context before processing a request and clearing it after processing a request.
    • Setting the logger context when the application is starting to shut down.
    This filter is a once-per-request filter. It is capable of filtering all the different types of requests (standard, asynchronous, error, etc.) but will not apply processing if the filter matches multiple times on the same logical request.
    • Constructor Detail

      • Log4jServletFilter

        public Log4jServletFilter()
    • Method Detail

      • init

        public void init(javax.servlet.FilterConfig filterConfig)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Filter
        Throws:
        javax.servlet.ServletException
      • doFilter

        public void doFilter(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response,
                    javax.servlet.FilterChain chain)
                      throws IOException,
                             javax.servlet.ServletException
        Specified by:
        doFilter in interface javax.servlet.Filter
        Throws:
        IOException
        javax.servlet.ServletException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Filter

Copyright © 1999-2016 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.