Log-Manager question

Posted by tbergman on 11-Jul-2016 14:56

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

All Replies

Posted by Ken McIntosh on 11-Jul-2016 15:04

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

Posted by tbergman on 11-Jul-2016 15:30

Hi Ken,
 
This seems to work unless I have a “BLOCK-LEVEL ON ERROR UNDO, THROW.” statement in the called program. Here’s what gets written to the log when I run a program that generates an error. Note the stack trace doesn’t have anything in it. Even with –errorstack there is no trace information. Removal of the BLOCK-LEVEL statement allows it to work properly.
 
[16/07/11@16:11:31.058-0400] P-010364 T-010344 1 4GL -- Logging level set to = 2
[16/07/11@16:11:31.058-0400] P-010364 T-010344 1 4GL -- Log entry types activated: 4GLMessages:4
[16/07/11@16:11:31.110-0400] P-010364 T-010344 1 4GL -- ** Invalid character in numeric input a. (76)
[16/07/11@16:11:31.110-0400] P-010364 T-010344 1 4GL -- ** ABL Debug-Alert Stack Trace **
 
The startup command is
_progres -b -debugalert -p testmessage.p -logentrytypes 4GLMessages:4 -clientlog foo.txt –errorstack
 
Here’s the log without the BLOCK-LEVEL
[16/07/11@16:23:58.636-0400] P-008856 T-003812 1 4GL -- Logging level set to = 2
[16/07/11@16:23:58.636-0400] P-008856 T-003812 1 4GL -- Log entry types activated: 4GLMessages:4
[16/07/11@16:23:58.706-0400] P-008856 T-003812 1 4GL -- ** Invalid character in numeric input a. (76)
[16/07/11@16:23:58.706-0400] P-008856 T-003812 1 4GL -- ** ABL Debug-Alert Stack Trace **
[16/07/11@16:23:58.706-0400] P-008856 T-003812 1 4GL -- --> foo testmessage.p at line 31  (.\testmessage.r)
[16/07/11@16:23:58.706-0400] P-008856 T-003812 1 4GL --     testmessage.p at line 28  (.\testmessage.r)
 
Thanks
 

Posted by bronco on 12-Jul-2016 02:11

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

Posted by Peter Judge on 22-Jul-2016 08:38

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.

This thread is closed