Search code examples
ejb-3.0seamauditing

Audit log with JBoss Seam (EJB3+JSF)


I would need to implement an audit log for a web application written with JBoss Seam. EntityListeners seem like good candidates, but I don't know how to connect the EntityListeners to the application session context to include the logged in used principal in the audit record.

I wonder if there is a way to do this "connection", or if there is a more confortable/elegant/effective way to implement an audit log for this programming environment.

Thanks in advance.

Rafa.

Edit:
Many thanks to Damo for his answer! I tried the injection of my identity component, but it did not work. However, the suggested call to Component.getInstance() did provide the desired reference to the user's identity in the EntityListener.


Solution

  • Have you tried injecting your Application/Session scoped Beans into the EntityListener? Or using Component.getInstance("myBean") if injection is unavailable.