You can extend WicketFilter like this
public class ImpactServletFilter extends WicketFilter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
super.init(filterConfig);
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
try {
super.doFilter(request, response, chain);
}
finally {
// put is done in onBeginRequest where I have the
ApplicationSession of wicket with my user
MDCHelper.get().remove(MDCHelper.ID);
}
}
@Override
public void destroy() {
super.destroy();
}
}
Don't forget to change also your web.xml :
<filter>
<filter-name>ImpactApplication</filter-name>
<filter-class>com.tsquare.impact.util.ImpactServletFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.tsquare.impact.ImpactApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ImpactApplication</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
Regards,
Fabrice
m00kie wrote:
>
> Hi,
>
> I would like to add some MDC information to logs of wicket RequestLogger.
> Unfortunatelly these MDC information are missed as RequestLogger invokes
> it's logging after invocation of WebRequestCycle.onEndRequest method which
> removes MDC entires.
>
> Is it a workaround for doing that?
>
--
View this message in context:
http://www.nabble.com/wicket---log4j-MDC-tp22784121p25818319.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]