Sign in to follow this  
Followers 0
RickB75

How to get remote error messages from a exe.

8 posts in this topic

Guys,

      I'm 3/4 the way through a project that I've been working on for a while now. It consist of a couple compiled scripts (.exe). I'm trying to make this app as full proof as I can. I know alot of you guys on here roll out compiled scripts to multiple pc's and work remotely. My question is, when you do have an issue with a compiled script, how do you know where the error is at in the exe? In SciTE, if there is an error, it writes the error to the console of where the script failed. My question is how do you guys normally get notified of errors and what broke with a exe when it doesn't run like it suppose to? 

Do you have a "If @error" all throughout your entire script on each function or do you have a main primary one and if there's an error to email you or something. 

I'm just curious how you guys handle it. 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I use AutoIt Debugger v0.47; http://www.thefoolonthehill.net/drupal/AutoIt%20Debugger.

The debugger its much more slow than compiled scripts, in some rare cases (events, interrupts, etc...) where speed is relevant in behavior i get real time info by temporal MsgBox in developping phase sometimes in critical points.

When the script is done, I have some custom funtions to write errors and warnings in logs (and moving them to a log server repository later), so you can check when you need, and yes even in some very critical error i do email me.

 

PD: The errors that broke the script are easy to realise and solve, the difficult are those you dont know about. :)

Edited by zalomalo

My english shucks, i know it.

Share this post


Link to post
Share on other sites

I guess my question is... Let's say you did have a critical error. The compiled exe couldn't finish it's run and get to the end of the file to log the issue's or warnings. Do you have a process in your script (a Fail Safe so to speak) that will alert you when that happens. I did search the forums and saw a post about adding Trace Lines into the script that will write to the console. I was thinking about maybe using something similar except writing to a log file. Then have a seperate script to check the log file for errors. If there was an error found to email me the file.

I just remembered, I have to save the log file after it's written so that won't work  if the script that saves the file has the critical error.  

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

RickB75,  

I just remembered, I have to save the log file after it's written so that won't work if the script that saves the file has the critical error.

 

Not necessarilly, create a function that opens, writes and closes a log file.  Then you can reference the file for debugging info in the event of a crash.

Something similar to this...

Func _L($str)
    Local $hfl = FileOpen($LogFile, 1)
    If $hfl = -1 Then Return
    FileWrite($hfl, StringFormat('%-24s', _Now()) & $str & @CRLF)
    FileClose($hfl)
EndFunc   ;==>_L

kylomas

edit: obviously you call the function for each item you want to write...

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The log dont say you what was wrong when the script crash, but you can check what was (depends on info you store) the last, before crashing.

I think that you want is, two process running and interact themselves someway IPC, when one of the process doesnt respond (crashed, killed, etc) as intended, the other should email you. Both proces should log the relevant info in the context the fail of communication happened.

Edited by zalomalo

My english shucks, i know it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If you are talking about symetrical redundancy or "heartbeat" systems then you've gone to another level.  Watcher processes are easy enough to implement but still don't tell you why one or the other crashed.  Based on what the OP has said, logging at critical junctures and providing notification through email should cover it. 

Reading this the following morning...holy crap, I think I just paraphrased what zalomalo said, apologies zalomalo...(I gotta start drinkin again)

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

I guess what I will do is in my main script, put checkpoints in it. At each checkpoint I will write to a log file. Then have a second script to run and make sure all the checkpoints were hit and maybe look for a key word like finished or Total checkpoints = XX or something like that. Then put an if statement in the second script saying If the log file doesn't have the key word or total checkpoints to email me the log file. That way I see the last checkpoint that was logged.

I just didn't know if there was a more common way that you guys on here do it.  That way if I ever have any questions, more people could chime in to maybe help me with the problem. 

Share this post


Link to post
Share on other sites

Well i told you before, its not very easy but the best is some Inter Comunication Proccess method, i like NamedPimes the most, and more even if is the same machine running the proccess.

I have some projects also with security issues and spend long time playing with files. At last and after look for some improved ways, and days to learn and testing i am happy with it. You can take some time up to do something that works and mastering, but after that point the potential of things you can do with easy (by example one proccess can be running in a alternate machine), goes much more futher than with logs and files.

I recommended you use both methods in combination.


My english shucks, i know it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0