my dog learned polymorphism*
The moose likes Java in General and the fly likes Audit trail logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Audit trail logging" Watch "Audit trail logging" New topic
Author

Audit trail logging

André Campanini
Greenhorn

Joined: Jun 20, 2008
Posts: 19
Hi,

I use JSF in my web apps.

I was looking for information about the best way to implement "Audit trail logging", and it's so hard to find information about it. So I found this Jesper Young's explanation and I liked it very much:

http://www.coderanch.com/t/384320/java/java/Log-debug-Log-Info-Log

I want to trail user's activities in a web app and register them in a database for a period of time.

So, I want to be sure about which way I have to implement this, and Jesper wrote a little about exactly what I'm looking for.

I also found some more information, but it didn't help me a lot:

http://forums.sun.com/thread.jspa?messageID=10331111
http://www.codesecurely.org/Wiki/view.aspx/Security_Code_Reviews/Logging__Auditing#Auditing

Any help about how to implement "Audit trail logging"?

Regards,
[ October 02, 2008: Message edited by: Andr� Campanini ]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14196
    
  20

Hello!

In that other thread I wrote that we implemented audit trail logging by writing log messages into a database.

What we did is not very complicated: there's one table with just a few columns (a timestamp, a varchar for the message, etc.) and we simply use JDBC to insert a new row into the table when an audit log message has to be stored.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

It's not too hard to write a database appender yourself. You just need to implement / override a few methods:

Now append cannot throw SQLException, so should one occur you can handle it as follows:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
André Campanini
Greenhorn

Joined: Jun 20, 2008
Posts: 19
Excellent! I'll work on it!

Thanks a lot!
 
GeeCON Prague 2014
 
subject: Audit trail logging