LogWEx can be installed as a servlet filter in a Web Application.

  • add the archive logwex-core-1.x.x.jar into the WEB-INF/lib/ directory of your war archive
  • add this in WEB-INF/web.xml :
  • configure your Log4J PatternLayout


TODO (version 1.1)

Log4J PatternLayout

LogWEx put the request data into Log4J's MDC. You can print those data into your log file (or console) by adding some %X... conversions to the PatternLayout. For example, in a log4j.xml file :

    <appender name="FILE" class="org.apache.log4j.FileAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="conversionPattern" value="%d %p %X{request.userName} - %m%n"/>

Here are some of the properties that are available in the MDC :

  • request.userName
  • request properties : request.scheme, request.serverName, request.serverPort, request.contextPath, request.servletPath, request.protocol, request.method,,...