• Post Reply Bookmark Topic Watch Topic
  • New Topic

SessionListener does not appear to be listening  RSS feed

 
William Stafford
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added a session listener to my app just to record the session activity. I do not see its' logged messages and if I run in debug mode the listener code is never executed.

I see no errors from either Tomcat or my app on startup or during execution.

I'm probably missing something fundamental for listeners but a web search did not give me any clue as to what it might be.

Any help or ideas appreciated.

-=beeky

Basically this is the code:
In a servlet:
Session s = req.getSession(true); // force creation of a session

In the listener:
public void sessionCreated(HttpSessionEvent se) {
session.setMaxInactiveInterval(60); // sessions last one minute
... do some logging

In web.xml:
<listener>
<listener-class>listeners.LoggingSessionListener</listener-class>
</listener>

The listener itself:
package listeners;
public class LoggingSessionListener implements HttpSessionListener {
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you know for certain that your servlet is being hit. Perhapes you have some display code in the servlet to make sure?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!