Important alert: (current site time 7/16/2013 2:40:04 AM EDT)
 

winzip icon

Extreme! 1.3 - Updated! Event Logging and GPF Interceptor Class

Email
Submitted on: 1/9/2006 10:08:16 PM
By: Steppenwolfe 
Level: Intermediate
User Rating: By 33 Users
Compatibility: VB 5.0, VB 6.0
Views: 22547
author picture
(About the author)
 
     The Ultimate Application Logging and Error Handling Interface!! Adds professional error handling to any application with just a few simple settings. Every developer who ever plans to publish his code could use this class. Error and application monitoring adds a layer of professionalism to your application, while saving you endless hours of misery dealing with vague end-user issues.. The Application logging interface logs desired events and status information and combines this with a powerful WMI interface that delivers rich and professional logging features. The event logging system catches every unhandled error, with options to resume or invoke a user dialog. Events are logged in complete detail - error number, context dump, custom messages for every known vb error, even the specific location in a module is tracked and recorded. Options include auto generated email error reports that will work with any email client, auto application restart, HTML report view, .txt logs and textbox view, and many other features and granular, well documented controls.. _______________________________________________ Updated ver 1.1 Extended properties for more flexibility. Added wmi test on class init, optional hard paths and check for logs, and fixed some small issues. Added css style properties to embed style elements on web report page. _______________________________________________ Another small update - found some small problems when testing each property, project has been updated with changes.. _________________________________________________ 1.3 is up.. added some fixes for gpf handler Cheers John

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 16 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/7/2005 4:06:44 AMSteppenwolfe

Did a small update and fixed a few issues/added more documentation..
(If this comment was disrespectful, please report it.)

 
12/7/2005 5:38:41 AMLight Templer

John, you are shooting in many directions, too ;-) Looks like lot of work - my ***** to it and regards - LiTe
(If this comment was disrespectful, please report it.)

 
12/7/2005 6:28:51 AMSteppenwolfe

Thanks Lite - gracious as always.. I just try to post stuff I think people can really use.. there are enough controls out there already ;o)
(If this comment was disrespectful, please report it.)

 
12/7/2005 7:08:44 AMJorgen Levesen

Verry informative and usefull, you got my 5 stars.
(If this comment was disrespectful, please report it.)

 
12/7/2005 10:03:02 AMKelley Hendrix

Looks great! My *****.
(If this comment was disrespectful, please report it.)

 
12/7/2005 5:14:04 PMSteppenwolfe

Added some more properties and gave it a once over for corrections.. I will upload a new version tonight..
Thanks for the votes people, it's nice to feel appreciated ;o)
(If this comment was disrespectful, please report it.)

 
12/7/2005 5:14:09 PMJames Miller

John ... I'm still reverse-engineering your registry submittals and constantly learning from it. Thanks for this submission as well because I'm sure I'll learn from it too. Congrats and ¤¤¤¤¤ from me.
~James
(If this comment was disrespectful, please report it.)

 
12/7/2005 6:07:50 PMOption Explicit

"there are enough controls out there already..." Watch it bub. Some of us like controls. :-) Looking forward to checking your latest out.

(If this comment was disrespectful, please report it.)

 
12/7/2005 7:35:58 PMSteppenwolfe

OE - that was inside joke between Lite and I.. (but.. -quil ridendo dicere severum- ;o) in jest is truth..
If you want to get in on mother of all subclass projects - drop me an email..
PS - got carried away on update - new version(1.1) will have some nice features like auto generate and link style sheet to web report.. I'll upload it tonight
(If this comment was disrespectful, please report it.)

 
12/8/2005 7:46:49 AMOption Explicit

Oh I'm just kidding around. In jest is truth indeed - PSC at times DOES seem like a control shop. Not that there's anything wrong with that! By all means email me about the subclassing project you have in mind.
(If this comment was disrespectful, please report it.)

 
12/9/2005 10:22:34 AMHeriberto Mantilla Santamaria

I had been looking for something as this time behind, but the search has finished.

Thanks.
(If this comment was disrespectful, please report it.)

 
12/9/2005 3:46:30 PMSoloSoftware

One nice addition will be to show the path of the application.
Very good. 5 from me.
(If this comment was disrespectful, please report it.)

 
12/9/2005 6:50:01 PMSteppenwolfe

Thanks for the cudos people.. I will do another update next week, if you have any suggestions, or spot any problems, just leave a message and I'll look into it..
(If this comment was disrespectful, please report it.)

 
12/12/2005 4:26:22 AMAJ Hill

Nice one - just found this and the possibilities are fantastic.
(If this comment was disrespectful, please report it.)

 
12/12/2005 7:35:55 AMPsiBorg

A coding piece of Art is an understatement here... Your coding Style is extremely neat and it quite obviously took you a while to space all the variable type declarations...

If anything, you would deserve an award for your work, it is both a lesson to all on coding style and error handling...

Although I have my own routines for error handling and thus will never use yours, I enjoyed looking at your code and how you handle your errors...

Many thanks for your submission, I really hope a few noobs learn from your coding style :-)
(If this comment was disrespectful, please report it.)

 
12/12/2005 5:41:14 PMSteppenwolfe

wow.. thanks guys, quite a tribute.. just thought this class would be usefull to people, and honestly didn't think it would get much notice, but it is good to be appreciated, thanks..
PsiBorg, found example of popup menu on vbal with your tag on it, is that you? If so, it has founs it's way into an project I am writting, quite a coincidence
(If this comment was disrespectful, please report it.)

 
12/13/2005 2:44:12 AMPsiBorg

I really do not keep track of the things I post, but if the coding isn't neat, I didn't post it ;)

I haven't posted in the last few months and nothing on PSC as I work now on top secret projects and as such are bound to not release any piece of source I've written, but usually I help many needing something specific...

Personally I'd love to go full open source and upload everything I've ever done, but there are too many out there who cannot be trusted to not copywrite my work and cause me harm...

My moto in life will always be, "Why reinvent the wheel when Dunlop is giving away the Blueprint"

Here's to 100% open source!
(If this comment was disrespectful, please report it.)

 
12/13/2005 5:45:19 AMSteppenwolfe

Have you guys seen Achilles yet? It is getting good..
(If this comment was disrespectful, please report it.)

 
12/15/2005 1:36:33 AMCris Friolo

Error:
While openning the project:
Error Message: Could not create reference "C:\Windows\sytem32\wbem\wbemdisp.tlb"

(If this comment was disrespectful, please report it.)

 
12/15/2005 1:37:34 AMCris Friolo

OS on error reported W2K Advance Server
(If this comment was disrespectful, please report it.)

 
12/15/2005 4:54:18 AMSteppenwolfe

I am betting you have had snmp management tool on their like cim or cworks, maybe has removed or upgraded native lib.. In notes I say you should test for reference with app installer, and install if necessary, check for system32\wbem\wbemdisp.tlb, if it is absent, go to MS and get a copy..
(If this comment was disrespectful, please report it.)

 
12/15/2005 11:52:31 AMSteppenwolfe

also.. server has option to install snmp? try that..
According to MS, all machines from ME on up, have management capabilities inbuilt, but it is best practice to always test for any dependency, and install if necessary.
(If this comment was disrespectful, please report it.)

 
12/19/2005 2:03:08 PMVlad Vissoultchev

On coding style: I would leave underscores for event handlers names only. e.g. Log_Start -- is this a function or the implementation of event Start on the WithEvents Log object?! A no-no naming convention in every VB6 programming book.

Why I would never use so much bells and whistles on the GPF handler in production systems? The moment you get an AV the VB run-time is usually in a compromised state -- simple (conversion) functions fail (with another AV) so accesing WMI, TCP/IP stack, WinINet (submitting mini-dump!) can be impossible. Best would be to thread lightly, dump text/bin logs and spawn external app to do the bulk of info gathering and mini-dump submission.

cheers,

(If this comment was disrespectful, please report it.)

 
12/23/2005 9:30:01 AMSteppenwolfe

Posting negative comments on both of my submissions this month.. (very un-cool from another contest runner). As for a virus infected system, perhaps it doesn't boot at all, or every application spawns a gpf? Perhaps dropping computer off the balcony will also break software..(a lot of rubbish). This is a good logging and event handler, meant for small run-of-the-mill applications, if people like it they will use it, if you don't like my submissions, don't download them.. nuff said.
(If this comment was disrespectful, please report it.)

 
12/23/2005 4:10:51 PMOption Explicit

Steppenwolfe, Vlad wasn't trying to flame your submissions imho. What I see is a highly technically proficient coder (one of the very best in PSC history) stating in plain, non-sugarcoated terms his opinions and alternatives. He's way above the kind of behavior you're accusing him of from, so don't lump him in with the gibberish-spouting flamers. Take constructive criticism in the spirit it was delivered and don't get so defensive. It makes you look bad, not Vlad. Perhaps you'd just like fawning, applause filled comments? It doesn't work that way here. Merry Christmas (really!) :)
(If this comment was disrespectful, please report it.)

 
12/23/2005 4:34:45 PMSteppenwolfe

OE, if this were truly meant as constructive criticism, it would have been sent as an email, and not here demeaning my project pages, (something I would never consider doing to another programmer).
(If this comment was disrespectful, please report it.)

 
12/23/2005 7:29:41 PMRichard Mewett

Steppenwolfe PSC is an open community so everyone has a right to comment, be it good or bad. The Feedback system is pointless if it is just a praise system/ego booster. I agree with OE that Vlad is the last person who needs to flame to win another COTM - and those guys leave one-globe votes. You have submitted some great code recently but you can't always get the votes/feedback you want here :) You are going to win with this anyway!
(If this comment was disrespectful, please report it.)

 
12/23/2005 7:48:17 PMSteppenwolfe

Alright, I'll ask moderator to remove comments. Maybe problem is just one with communication here. I am fairly new to vb/c++ programming, (only since March), but I think people take that as being new to programming, (and I am ios programmer for many years). So, I get offended when I feel someone is talking down to me, and react badly. My apologies Vlad.
(If this comment was disrespectful, please report it.)

 
12/24/2005 8:35:25 AMOption Explicit

- sniff - ain't the Christmas spirit great? ;)
(If this comment was disrespectful, please report it.)

 
1/8/2006 10:02:13 PMHeriberto Mantilla Santamaria

Congratulations Jhon.
(If this comment was disrespectful, please report it.)

 
1/9/2006 12:15:58 PMJim

Great code.
I'm having trouble understanding exactly how to implement it though. It seems the RaiseAnException procedure is always called in your example, whether or not the the app is in the IDE or compiled and executed. To try and generate an error I removed the If InIde test, and simply added a division by zero error with i = 1/0, then I compiled the application and ran it. VB picked up the error and through a message, and then the app exited. I did not get the frmEvent form. Am I doing something wrong? Thanks.
(If this comment was disrespectful, please report it.)

 
1/9/2006 1:08:58 PMSteppenwolfe

Jim, you are not doing anything wrong ;o) The inIde function has a bug, thanks for pointing it out. I will do an update later today.
(If this comment was disrespectful, please report it.)

 
1/9/2006 8:01:12 PMSteppenwolfe

Hey all.. I have uploaded a new version with fixes. It seems exception handler will not manage all exceptions, some are passed to runtime handler, (perhaps those ms thought most grievous, but seems to catch 70%). This is by action of the setunhandledexception api, not the application. I did find a couple bugs though, so thanks Jim for pointing it out..
(If this comment was disrespectful, please report it.)

 
1/16/2006 6:00:48 PMAlwin

Hey Steppen .. Excellent piece of code .. wanted to make something similar for a long time .. thanks for sharing the code .. i too had the same problem of [Divisible by Zero] .. This particular error occurs most of the time in our applications .. It would be great if there is a vay to catch it .. Anyway 5 big globes from me buddy ..

(If this comment was disrespectful, please report it.)

 
1/18/2006 4:19:42 PMSteppenwolfe

Hi Alwin
The original project mission was to create a standardized logging interface. Rather then using a dozen or so api to collect system info, wmi just seemed a whole lot cleaner. The gpf handler was an after thought, but really, no handler is a substitute for routine level problem avoidance/management. If I think something will spawn an error, I will usually try to avoid it from happening, (like test the value for zero, and exit early). Best approach IMO, is to write with no error handling, then see what breaks, and if you must, add a local handler..
(If this comment was disrespectful, please report it.)

 
5/16/2006 12:05:04 AMkbhrx

thanks for handling my error :)
it's help me alot
(If this comment was disrespectful, please report it.)

 
6/2/2006 10:35:35 AMSpector

Excellent job Steppenwolfe! This is perfect for flushing out bugs during beta testing.
(If this comment was disrespectful, please report it.)

 
2/11/2007 7:24:55 PMSteppenwolfe

It recently came to my attention that the SetUnhandledExceptionFilter api has been effectively neutered by M$ in an attempt at better security. The api no longer redirects errors to the handler function on up to date machines, so, start looking for a replacement if you are using this function. One method is to hook the api, some details: (c++)
http://einaros.blogspot.com/search?updated-min=2006-01-01T00%3A00%3A00-08%3A00& updated-max=2007-01-01T00%3A00%3A00-08%3A00&max-results=17

(If this comment was disrespectful, please report it.)

 
2/11/2007 7:28:32 PMSteppenwolfe

Another note for this project: Current wmi library (test- xp sp2), can stall, or take a long time fetching data on installed software. If this happens when running this project, go to mMain.bas and rem the line: .DataSft = True. Another patch perhaps?
(If this comment was disrespectful, please report it.)

 
2/12/2007 5:32:41 PMULLI

maybe my windows is not up to date then, bedause both yours and mine work on my machine. reminds me of the old saying, dating back to my COBOL days: never touch a running system unless you have to.
(If this comment was disrespectful, please report it.)

 
2/13/2007 11:18:17 AMSteppenwolfe

Ulli,
It looks like they have been working on changes to handler invocation for a while now, as evidenced in various VC++ forum chatter see:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=4c9e4 bf1-43e7-4ad5-9610-c09ff294bf18
It
worked on my box a couple of months ago, now it circumvents the filter.
(If this comment was disrespectful, please report it.)

 
3/27/2007 12:41:20 PMPostMan

Remming out .DataSft didn't seem to keep if from not responding on startup for me. It didn't seem to hang when run from VB, but of course the exception test doesn't work properly there. I tried to rem out other properties, change values (and various combinations). The only thing that worked was to rem out .OnStart, which tends to defeat the purpose of the code. By the way, this worked fine for me a while ago too. Five stars to you for what used to be very usefull code, four negative stars to microsoft for breaking it.
(If this comment was disrespectful, please report it.)

 
2/15/2011 4:46:02 AMxmaster81

thanks for the code
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.