Logging Conversation Demarcation In Seam
One way to see where your conversations start and end is to use the Seam event model to observe the conversation start and ends.
@Name("conversationListener")
@Scope(STATELESS)
public class ConversationListenerBean implements ConversationListener {
@Logger
private Log log;
@In
private Conversation conversation;
@Observer(value="org.jboss.seam.beginConversation")
public void observeConversationStart() {
log.debug("Conversation #0 Started",conversation.getId());
}
@Observer(value="org.jboss.seam.endConversation")
public void observeConversationEnd() {
log.debug("Conversation #0 Ended",conversation.getId());
}
}
Just add this bean into your project and it will automatically log when you start and end conversations.
2 thoughts on “Logging Conversation Demarcation In Seam”
Comments are closed.
What is the FQN of ConversationListener? What version of SEAM?
The FQN is defined as “conversationListener”, this is a bean you add in your project. You can call it what you want since Seam creates it, registers the event listeners and just calls it when a conversation is started or ended.
It should work in any version of Seam 2.03CR1 and above. I think these events were added around this version, but it is possible the event names got changed in another version.
Cheers,
Andy