File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Audit trail logging

André Campanini

Joined: Jun 20, 2008
Posts: 19

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:

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:

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

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

Joined: Aug 16, 2005
Posts: 15081


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

Joined: Oct 27, 2005
Posts: 20269

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:

How To Ask Questions How To Answer Questions
André Campanini

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

Thanks a lot!
I agree. Here's the link:
subject: Audit trail logging
It's not a secret anymore!