06-22-2016 07:22 PM
Hi all,
I was wondering if someone could point me in the right direction where I can read about and see examples of event logging. I have written programs before that run well for a long time or until the end user has stopped the program, but sometimes the program will only last a short time and stop recording for example. I would like to see what's going on. I read a thread about Action Engines, but I am not sure how to apply that to my program (at least not yet).
Any infomation would be greatly appreciated 🙂
Solved! Go to Solution.
06-22-2016 07:33 PM
Your best best to begin with is just to use "Highlight Execution" to see what's going on under the hood when things fail. If your application fails randomly over long periods of time, you should instead look into error handling. That little yellow and black wire you see on most VIs? You can use it to let your program fix itself, while it's running!
Here's a nice guide to error responses in LabVIEW that I use quite frequently: https://decibel.ni.com/content/servlet/JiveServlet/previewBody/42163-102-1-83306/LabVIEW%20Error%20R...
You can also just log things to a spreadsheet, or put indicators on your front panel showing various application health things.
06-22-2016 09:32 PM
Thank you for the suggestions. I will certainly look into these!
06-23-2016 06:43 AM
Regarding what you were saying about action engines, this is a common way I deal with error logging. In addition to adding logic to your program that decides what to do in case of an error (eg: ignore it and keep going, stop because it is critical, etc, basically this is what the document that ijustlovemath posted goes over), you also might want to log your errors so you can look at them later - that's where error logging comes in. What I often do is write an action engine that is in charge of my error logging, and it is basically just a VI that you call whenever you want to log errors that might be on the error wire (or you could even make it just log events in general, instead of only errors), so you wire in the error or a string about the event or whatever, maybe a priority level to be fancy, and then the VI takes the info and gets the date and time and formats that and appends it to a file that it is keeping on an uninitialized shift register (you will want to write the VI so it checks if it is the first time it is called and if so, creates a file and puts that on the shift register). Hopefully this makes sense. If not, I can explain more.
--Hope
06-23-2016 08:47 AM - edited 06-23-2016 08:48 AM
I developed an Event Logger back in LV 6i that has been enhanced over the years and after becoming our most re-used set of VIs is now used in almost every one of the applications I deliver.
It is a set of VIs that first launch a background thread that watches a queue and logs any updates to a text file with a time stamp.
The queue ref is stored in an AE (is anyone suprised by that by now?) that is wrapped in a re-entrant VI that has a Error In and an Error Out. If the error is set the call chain and the error cluster are qued up to be logged.
All of my peers love it.
It lets me go back in time to investigate what may have happened three months ago and determine exactly what error may have occured.
Ben
06-23-2016 10:03 AM
Thanks Hope,
I read some more about Action Engines and I tried making my own event logger for errors. It is a simple one (I think). I attached it as well as the main VI for my program. Do you think this is something I should use for my application? Or am I way off?
06-23-2016 10:10 AM
I should probably give you some more information about my program, sorry about that.
I am programming a scanning multimeter where the end user can select the number of channels they need to use, name them, monitor and record them. The program will check if the channel has reached some compliance and send a text message if it has (to be added). It also has an update button which allows the user to add new channels, remove channels or rename channels. The user can also enter how often the meter takes a measurement too.
06-23-2016 10:16 AM
06-24-2016 08:08 AM
Thank you, enjoy your weekend 🙂
06-24-2016 08:12 AM
Oh actually, I rewrote some of my code! So far it is recording the state and errors. I would still love some feedback though if you don't mind! 🙂