Logging, diagnostics and traceability
FWLogMsg(cSeverity,cTransactionId,cGroup,cCategory,cStep,cMsgId,cMessage,nMensure,nElapseTime,aMessage)Correlates execution events without exposing sensitive data.
Overview
FWLogMsg takes severity, transaction identifier, group, category, step, code and message. Documented levels are INFO, WARN, ERROR, FATAL and DEBUG. Arguments eight and nine are numeric measures; the tenth is a key/value-pair array. Order matters: an array in position eight does not match the contract. A stable execution identifier helps trace related events. Without LogServer, documentation indicates ConsoleLog output. (Sources: refs. 1–2.)
Syntax
FWLogMsg(cSeverity,cTransactionId,cGroup,cCategory,cStep,cMsgId,cMessage,nMensure,nElapseTime,aMessage)Commented example
#Include "Protheus.ch"
User Function Ed511()
Local cTrace := FWUUIDV4()
// Same identifier; fixed messages, no customer data.
FWLogMsg("INFO",cTrace,"EDITORIAL","EXAMPLE","START","ED511","start",0,0)
FWLogMsg("INFO",cTrace,"EDITORIAL","EXAMPLE","END","ED511","end",1,0)
Return NilTwo INFO events share cTrace; destination depends on logging configuration. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Record operation, step, duration and outcome. Exclude passwords, tokens and personal payloads. Bound retention and volume; DEBUG needs specific configuration and should not be enabled indiscriminately. Capture error evidence without hiding failure or promising universal recovery.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.