Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Logging, diagnostics and traceability

FWLogMsg(cSeverity,cTransactionId,cGroup,cCategory,cStep,cMsgId,cMessage,nMensure,nElapseTime,aMessage)

Correlates execution events without exposing sensitive data.

Logging, diagnostics and traceabilityAdvPL
01 · OVERVIEW

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.)

02 · SYNTAX

Syntax

FWLogMsg(cSeverity,cTransactionId,cGroup,cCategory,cStep,cMsgId,cMessage,nMensure,nElapseTime,aMessage)
03 · PRACTICAL EXAMPLE

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 Nil
Expected result

Two 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.

BEST PRACTICES
  • 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.

Related content

REFERENCES
  1. TOTVS. FWLogMsg. TDN. Accessed on 2026-10-27.
  2. TOTVS. FWUUIDV4. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha