?
Solved

Log user actions

Posted on 2007-08-07
7
Medium Priority
?
253 Views
Last Modified: 2013-11-07
Hi,

For a webapplication I would like to be able to see what users do exactly, using some kind of logging system. What I have in mind is something like:

Public Sub Log(ByVal UserID As Integer, ByVal Action As Integer, ByVal Parameter As Integer)
  MyData.InsertLogEntry(UserID, Action, Parameter)
End Sub

This then should be attached to methods reading, updating, inserting and deleting data. For example:

Public Sub Delete(ByVal MessageID As Integer)
  MyData.DeleteMessage(MessageID)
  MessageCacheDelete(MessageID)
  LogSystem.Log(MyUserID, 100, MessageID) 'The number 100 is the log action defined in the database
End Sub

Something like that. This is of course a rough sketch, as it has some flaws (for example what if a method has more than one parameter, should be saved as well).
Basically I would like to be able to be able to save each action done by a user. And preferably without having to extend each method.

Does anyone know how something like this could be achieved?

Kind regards,

Martin de Ruiter
0
Comment
Question by:dhmderuiter
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:TSmooth
ID: 19647522
I think what you have already will fulfill your needs. To handle the multiple parameters issue, simply make that a string value and then separate your parameters with a comma or some other separator.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19647582
Look into log4net:

Apache log4net: Home
http://logging.apache.org/log4net/

Bob
0
 

Author Comment

by:dhmderuiter
ID: 19649101
Thanks for the lo4net suggestion, although it's different than what I'm looking for, as I'm not looking for an error logging feature, I would like to log all user actions.

Indeed the current thing could work with some adaptions, but I'm asking, is there an easy way to include it in every function and sub? Without having to add it to all the methods, so it automatically logs which function has been used by which user, including used parameters.

Another thing I was wondering, as with such extensive logging as this, what would performance-wise be the most effective way to implement this? As I guess that doing in SQL insert statement on each action could slow thing down considerable?

Thanks,
Martin
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 19649463
log4net is a logging feature--period.  You can log user actions, events, exceptions, etc.

How much information are you looking to log?  Where are you wanting to write the information to?

Bob
0
 

Author Comment

by:dhmderuiter
ID: 19649582
Okay, I thought log4net is only for logging exceptions and stuff... I will take another look at it.

Basically I want to log all kind of actions, it's for a student administration system, so for example: log creation of new students/grades/courses, log deletion of students/grades/courses, selection of students/grades/courses records, updating of students/grades/courses, etc. It be configurable in the application itself what should be logged and if logging for a specific object should be enabled (during some periods I would want full logging, sometimes not).
0
 

Author Comment

by:dhmderuiter
ID: 19649592
Oh, and I forgot, I probably would want all this logging information into a database table, to allow easy and fast retrieval of such a log.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 19657697
log4net has a database appender, plus you can easily create your own custom appender to write log events.

Bob
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question