473,671 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logging certain type of events

50 New Member
Hello,

I'm creating an application and want to build some kind of logging system.
I want to first create my list of events in database with a certain code. Then when the operation occurrs I want to log this event in my database together with this code.

My table with event codes would look something like this:
CODE DESC

and the events logging table would look like this
ID EVENTCODE USER TIME


Now i'm wondering how I would do this in code. How do I keep track of which codes I have because if someone deletes a user for instance I would log something like:
1 DELUSR JOHN 5/5/2009 12:33

How can I keep track of this dynamically?
I don't want to create an enum and link these enums to a certain code because is too static for me.

Any idea someone?
May 5 '09 #1
1 1151
cloud255
427 Recognized Expert Contributor
Hi

Somewhere you will have to tell your application which event to log. There is no way that the program can know what event corresponds to which eventcode without you explicitly specifying it.

So in your event handlers you will have to go to the DB to get the eventcode and then write that to your logging table.

Some of your events will most likely cause a change to your data, in this case you can use DB triggers to do the logging as this will save you one DB call to log the action.
May 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2254
by: Tero Saarni | last post by:
I'm using Logging in my library module for producing trace log of certain events. For being more useful these log entries should be associated with the filename and line number of *users* code that was issuing the library call. This is similar to what Logging itself does since it doesn't print "logging/__init__.py" as value of %(filename) but instead it prints users file where logging method (info, error...) was called. What would be...
3
1445
by: olsongt | last post by:
I'm trying to be a good boy and use the logging module but it's behaving rather counter-intuitively. I've posted a simplified test script below. To summarize, I've set the basic config to only log root level messages with >= ERROR level. I've created another named logger that logs on info level. I've set it up so it just shows the message text without "INFO:: logger:" boilerplate. The way I see things, when I call otherLogger.info,...
0
395
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' But when i am trying to run the sample, i am getting the following error in the Event Viwer Kindly help me on this
6
1540
by: Matt | last post by:
I have an ASP.Net page that receives batch transmissions of data from clients. I would like to add some type of logging to this application so I can review transmission issues easily. I tried writing to a file but quickly found when multiple clients are hitting the web page at the same time it causes all kinds of issues with multiple threads trying to use the same file. I was wondering if anyone has a solution they would like to share...
4
1617
by: samwyse | last post by:
In the Python 2.5 Library Reference, section 14.5.3 (Logging to multiple destinations), an example is given of logging to both a file and the console. This is done by using logging.basicConfig() to configure a log file, and then calling logging.getLogger('').addHandler(console) to add the console. However, in section 14.5.4 (Sending and receiving logging events across a network), a call is made to rootLogger.addHandler(socketHandler),...
6
7577
by: Larry Bates | last post by:
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I REALLY need to be able to monitor LOTS of running programs/processes and thought it would be nice to have them use SocketHandler logging and then I would write TCPServer to accept the log messages for real-time monitoring. I Googled (is that now a...
6
1035
by: McA | last post by:
Hi all, I need a recommendation. I would to like to use the logging module to create log messages the following way: a) Every log message does go to a admin sink. b) The logging of special messages should go to the admin sink AND to a sink specifically for a certain addressee. c) I don't want to write the log message to two different loggers for that purpose. I would like to do it this way:
6
1720
by: Thomas Heller | last post by:
I'm using the logging module in my comtypes library to log 'interesting' things that happen. In other words, the idea is if the user of the library is interested in the details that happen in the package internally, he (she?) would configure a logging level and handlers that write the log messages where it is convenient. This works great, with one exception: If the script using the library does NOT configure logging, and somewhere the...
1
2614
by: arunairs | last post by:
Hi, Using the EnterpriseLibrary 4.0, is it possible to Log the method name in the log file. I have it cofigured thus: <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true"> <listeners>
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.