Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2004

Tip: Looking for answers? Try searching our database.

Creating an audit log

Thread view: 
Linda - 10 Jun 2004 13:23 GMT
I need to create an audit log for a customized JAVA application.  The
log will track all changes to an Oracle 9i database.  The database
contains 25 tables with about 1000 fields.  Any suggestions on the
best approach.  Thanks
Gordon Tillman - 10 Jun 2004 14:57 GMT
Hi Linda,

> I need to create an audit log for a customized JAVA application.  The
> log will track all changes to an Oracle 9i database.  The database
> contains 25 tables with about 1000 fields.  Any suggestions on the
> best approach.  Thanks

I guess it depends on a couple of things...

Do you need to track every detail of what was updated, or just a more
general "this table was updated by this user at this time" type of
thing?

Do you want to keep your audit log in the database or in a separate
file?

One class that I wrote recently is kind of spiffy -  You create an
instance of it and from that point on while your application is
running, anything sent to stdout or stderr gets stored in a log file.
Each line is date/time stamped automatically with an indicator (can be
anything you like) to show which stream was written to.  The log files
clean up after themselves.  They are created automatically by the class
and a new log file is created for each day.  The class will also
automatically keep just the x most recent number of days of logs.

You could perhaps use a scheme like that and in your code that updates
the database tables just write an entry to stdout that describes the
change in some format that is suitable for your needs.

--gordon
Erik Sundlo - 10 Jun 2004 20:13 GMT
> > I need to create an audit log for a customized JAVA application.  The
> > log will track all changes to an Oracle 9i database.  The database
> > contains 25 tables with about 1000 fields.  Any suggestions on the
> > best approach.  Thanks

Oracle has built-in audit possibilities, or you can easily create your own
audit in Oracle table-triggers (Post-insert/Post-delete/Post-update). Why
don't you let the database handle it ?

Erik
Will Hartung - 10 Jun 2004 21:56 GMT
> > > I need to create an audit log for a customized JAVA application.  The
> > > log will track all changes to an Oracle 9i database.  The database
[quoted text clipped - 4 lines]
> audit in Oracle table-triggers (Post-insert/Post-delete/Post-update). Why
> don't you let the database handle it ?

I would suggest exploring this. The detail is most audits need to know WHO
is changing the data, so you'll need to have an explicit usre login to
Oracle to facilitate this (vs a generic Oracle login that's used to access,
say, a User table for application log in).

We can't use Oracle auditing in our J2EE application because all of our
connections come from a Database pool, and are all logged in as a generic
system wide user.

You CAN however, (as I understand it) associate some "meta data" with a DB
connection that can be audited as well, so it may simply be a matter of
associating the application user login id with each connection, even if you
use a generic Oracle log in. With a Swing app, this would be easily done in
the (I assume) central "get connection" method that most every application
has, and can assoiciate the global login id whenever it returns a
connection. Other wise you need to pass the login id to that getConnection
method every time (which is sort of a pain, and this is why at this juncture
we're STILL not using Oracle auditing, too invasive to make this switch to
our codebase at this point).

Finally, if your code is factored properly, just start dropping "audit"
calls in all of your calls that hit the DB. It's Work, and it's a Pain, but
it does the job.

Regards,

Will Hartung
(willh@msoft.com)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.