You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by m00kie <mo...@epf.pl> on 2009/06/19 14:17:46 UTC
RE: wicket & log4j MDC
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-tp22784121p24110412.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: wicket & log4j MDC
Posted by fdn <fa...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org