<session-config>
<session-timeout>30</session-timeout>
</session-config>
package com.sj.bo.common;
import java.util.Date;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.apache.log4j.Logger;
public class HttpSessionCheckingListener implements HttpSessionListener {
Logger log = Logger.getLogger(this.getClass());
public void sessionCreated(HttpSessionEvent event) {
if (log.isDebugEnabled()) {
log.debug("Session ID".concat(event.getSession().getId()).concat(" created at ").concat(new Date().toString()));
}
}
public void sessionDestroyed(HttpSessionEvent event) {
if (log.isDebugEnabled()) {
log.debug("Session ID".concat(event.getSession().getId()).concat(" destroyed at ").concat(new Date().toString()));
}
}
}
<listener>
<listener-class>com.sj.bo.common.HttpSessionCheckingListener</listener-class>
</listener>