开发者

JSF web application user logging. How to?

开发者 https://www.devze.com 2023-03-17 06:29 出处:网络
The administrator of the web application I am working on, asks for a \'I wanna know everything\' log. He wants to track all what the other users did when they were connected (logged in) to the web app

The administrator of the web application I am working on, asks for a 'I wanna know everything' log. He wants to track all what the other users did when they were connected (logged in) to the web app :

  • What pages he/she visited.
  • What actions he/she performed.
  • On what entities (JPA Entities) he/she performed actions.
  • At what exact time she/he performed a given action if successful.
  • What attribute of the a given record he/she modified.
  • The user principals of this user.

All I could do now, is export a CSV file where the administrator finds the user principals, the time this user logged in and logged out. I also created an example history table in database populated by EclipseLink Customizer to track changes for a corresponding table. (The problem with this EclipseLink customizer is that it is not flexible, because database tables are changing with time (adding/removing attributes) and 开发者_StackOverflow中文版so are their corresponding entities. And the user does not want to modify things two times (one time in the main table and the second time in the history table)!

Could something like a third library 'log4j' do that?

  • Is there any alternatives, solutions, or better practices related to my issu!?

Best regards.


Look into Interceptors/Listeners - both for JSF to get page/action and JPA to get data accessed. In your interceptors/listener you could then log to file using log4j.

EclipseLink Listeners

Hibernate Interceptors (for comparison)

JSF Listeners

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号