Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

How to write trace (logs) for our code in X++ ?

(0) ShareShare
ReportReport
Posted on by 225

Hello,

Can anyone suggest the best practice to write trace (logs) for our code in X++. So in case of any issues we can collect that logs and find where the issue is. 

I have gone through Trace functionality of D365 F&O. where we can analyze that trace file in trace parser to collect performance related information but I think we can not write our logs in that. right ? let me know if I am missing anything here.

  • barbarsav Profile Picture
    barbarsav 30 on at
    RE: How to write trace (logs) for our code in X++ ?

    Hello Rami,

    As you said, Trace Parser is being used for perfomance issues. You can not add or remove anything from Trace file that client generates.

    If trace parser doesn't work for you, u can crate log table and specific fields in it and than insert records line by line while your customization code running like example below.(Insert type of log, type of business , execution timeStamp etc...). 

    pastedimage1618212179824v2.png

  • Martin Dráb Profile Picture
    Martin Dráb 230,476 Most Valuable Professional on at
    RE: How to write trace (logs) for our code in X++ ?

    Standard logs are available in Event logs (on T1 environments) and in LCS (for other environments).

    If you want you create additional logs, you might be interested using Azure Application Insights.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,784 Super User 2024 Season 2 on at
    RE: How to write trace (logs) for our code in X++ ?

    Hi Pratik,

    What exact issues are you expecting? What details you do want to store and where? Wouldn't be better to use the SysTest framework for automated testing? Or when you find an issue, you can use the debugger to find the root cause.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,784 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,476 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans