I'm trying to configure the log manager for some batch programs. I'd like to log all errors and, when there's an error, get the 4GL trace messages or at least the name of the program that caused the error.
In the AppServer logs, when an error occurs it shows the program name that cause the error. I'd like to get similar behavior from the log-manager when running ABL:code.
So far, I've tried various options of startup commands but have not been able to find a combination that will result in 4GLTrace info only when an error occurs. I can get the errors but if I turn on 4GLTrace, at any level, I always get the trace messages in the log. I'd prefer to only see them in the event of an error.
Is there a way to do this?
Thanks
Hi Tom,
Use 4glmessages and use the -debugalert parameter when starting your application. Also, if you're using structured error handling in your application it's best to startup with the -errorstack parameter. This will ensure that you see the correct stack entries, not the ones from a thrown error that originated in a CATCH block.
Cheers,
Ken Mc
Whether it's intentional or correct I do not know, however if you do a "catch all" at the top level procedure like:
catch err1 as Progress.Lang.Error :
log-manager:write-message(err1:GetMessage(1)).
log-manager:write-message(replace(err1:CallStack, ",", "~n")).
end catch.
you'll be able to catch and log any error *with* a stack trace.Personally I think the block-level statement is a blessing.
Editted: code in non-proportional font
Just a note that in order for the CallStack property to return anything useful, you need to enable it. Do this via SESSION:ERROR-STACK-TRACE = true or the -errorstack switch.