Hi all,
I noticed that when there is a run-time internal error in my application, Harbour won't produce an error log in a text file just like the one produced by Xbase++.known as "error.log." I googled for hours, but haven't came across the same problem in the forums.
I learned about set(_SET_HBOUTLOG,"whatever.log"), but I couldn't make it work. I tried the following suggestion:
PROCEDURE Main()
LOCAL n
? "We are running and now an error will raise"
n++ // an error should raise here
HB_SYMBOL_UNUSED( n )
RETURN
True, indeed, an error was raised. After all, it was one of Harbour developers who wrote it. However, it printed an error on the screen only, no so-called "hb_out.log" or some text file containing the error information displayed on the screen.
Somewhere, Viktor Szakáts mentioned about "ErrorInHandler()." So I tried the following experiment:
PROC Main()
set(_SET_HBOUTLOG,"jun.log")ErrorInHandler() // to force an internal error
RETURN
The one I needed came out at last, an error log printed in a text file; in my experiment I called it as "jun.log". Here's the text info in the text file that ErrorInHandler() created.
Application Internal Error - d:\dev\13\10MenuH\5_1_0\10MenuLb\try.exeTerminated at: 2013.08.16 16:24:49Info: JUN.LOGUnrecoverable error 9001: Error recovery failureCalled from ERRORINHANDLER(0)Called from MAIN(6) in try.prg
------------------------------------------------------------------------
However, when I applied the ErrorInHandler() function in another error-scenario, Harbour becomes silent again. Here's what I did using my first example: I inserted ErrorInHandler(). Observe the following:
PROCEDURE Main()LOCAL n? "We are running and now an error will raise"n++ // an error should raise hereErrorInHandler() // <<-----------------
HB_SYMBOL_UNUSED( n )RETURN
My worse experience was that when I compiled my application with gtwvt (hybrid gui) it won't give an error message even the one Harbour is displaying on screen when there's a run-time error on pure text mode app. I know that I have this trouble because I don't know Harbour as much as others do.
Is there any one out there who can help me out of this trouble?
Thank you so much.
JUN
Hi Jun,
look here for an easy example. Sure, you can add more info like date and time etc..:
https://groups.google.com/d/msg/harbour-users/pQx9rIp8i90/aJ4iP9-WdwwJ
The new errorblock can be set f.e. at start in main function.
You can also handle different errorblocks for different occasions, like expected run time errors in a sub-routine, and then restore it back to the one before ...
Basic background info:
http://x-hacker.org/ng/53guide/ng40105.html
regards
Rolf
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-users+unsubscribe@googlegroups.com
Web: http://groups.google.com/group/harbour-users
--- You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Does every Harbour application programmer want error logs saved in the systems of their customers? I don't think so. Do many Harbour users want that? Yes, probably. So which is better? To give everyone an opportunity to easily add whatever code he/she wants in order to fulfill that wish or to force those who do not want it to remove code from errsys.prg? How many minutes did it take for you to borrow the xhb code and add it to your project? Was it difficult?
What do you mean with "endlessly"? You do it once unless you want different functionality in different projects.
Regards,
Klas
for a quick success:
PROC MAIN
xhb_errorsys()
cls
use notthere new
return
compile/ link it with:
hbmk2 jun.prg xhb.hbc
( the xhb.hbc links the xharbour contrib lib and it's dependencies )
-- then you have the fine Klas solution.
( right, a STATIC function can only be called from a function WITHIN the same .prg module )
+++
What xBase++ is doing, you should find in
c:\alaska\xppw32\source\sys\errorsys.prg
You can not use that directly, as xBase++ is using therin non-Clipper functions [ i.e. msgbox() ], which are unknown in Harbour.
Further they use 'SET ALTERNATE TO' to redirect console output into a file -- a third way to Rome, and there maybe more ...
regards
Rolf
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.