开发者

A unique ID per User / Session in logs on all levels? Log4J?

Well we are doing some performance testing to figure out what steps of our application take how much time. Of course easy to parse / filter logs with regexp are a charm. To the problem: Our jsf application is split into several projects, which are used by other (non jsf) applications. My first approach would have been:

if(logger.isDebugEnabled())
        logger.debug("Service call took: " + (System.currentTimeMillis() - time)+ " JSESSIONID="+CookieUtil.getJsessionId(FacesContext.getCurrentInstance())) ;

(CookieUtil would read the sessionId from the HttpServletRequest)

But... obviously oth开发者_开发百科er projects don't like dependencies to JSF libraries, nor to my neat CookieUtil. Does log4j provide something? Is there another tool / concept for this?


You could accomplish what you are looking for w/ log4j MDC: Log4j MDC

and using a Servlet Filter similar to this example: MDCServletFilter

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜