I have followed the wiki regarding Repository Selectors for initialising log4j,
and have got it working for my web apps.
I am using struts 1.2 and in the struts actions, I can use log4j and have it
log properly. I also have a log statement inside the InitServlet where log4j is
initialised and it works too.
However when I try and log from inside a servlet filter the logging does not
get executed at all.
The filter is one to determine if a user is logged in, and if not redirect to
the login page. This is working as the redirection happens properly. However
the logging is not.
This works:
| public class InitServlet
| extends HttpServlet {
|
| private static Logger log;
|
| public void init(ServletConfig config)
| throws ServletException {
| super.init(config);
|
| ServletContext context = config.getServletContext();
|
| System.setProperty("log4j.log.dir",
getInitParameter("log4j.log_directory"));
|
| String configFile = getInitParameter("log4j.config_file");
|
| Log4JRepositorySelector.init(config, configFile);
| log = Logger.getLogger(getClass());
|
| log.debug("logging initialised");
|
| [snip]
| }
| }
|
This doesn't work:
| public class LoginFilter
| implements Filter {
|
| private Logger log = Logger.getLogger(getClass());
|
| public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
| throws IOException, ServletException {
| HttpServletRequest req = (HttpServletRequest)request;
|
| log.debug("uri = " + req.getRequestURI());
|
| [snip]
|
| // otherwise continue
| chain.doFilter(request, response);
| }
| }
|
Can someone shed some light on this please?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3937444#3937444
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3937444
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user