Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

How can we get text from infolog ?

Posted on by

Hello,

I want to know if is possible to get the mesage given in infolog in a log message ?

For example, when we have error in a action, AX give us error in an infolog, I want to know if I can keep this message in an infolog ?

 

Thanks by advance.

*This post is locked for comments

  • Klaas Deforche Profile Picture
    Klaas Deforche 2,431 on at
    Re: How can we get text from infolog ?

    Hi Hatice,

    You can get the content of the infolog as a container like this:
    infologData = infolog.infologData();

    You can then store this container, or loop the contents of it.
    Doing this will clear the infolog, so you might want to display it again like this:
    infolog.view(infologData );

    To check if there are errors in the infolog, do something like this:
    private boolean hasError(Container infoLogData)
    {
        boolean              hasError = false;
        SysInfologEnumerator sysInfologEnumerator;
        ;

        // analyse the infolog to see if there are any errors
        sysInfologEnumerator = SysInfologEnumerator::newData(infoLogData);

        // loop the enumerator and
        // jump from loop when an error has been found
        while (sysInfologEnumerator.moveNext() && !hasError)
        {
            switch (sysInfologEnumerator.currentException())
            {
                case Exception::Error:
                    hasError = true;
                break;
            }
        }

        return hasError;
    }

    Is that what you are looking for?

    Best Regards,
    Klaas Deforche

  • Suggested answer
    Luegisdorf Profile Picture
    Luegisdorf 1,930 on at
    Re: How can we get text from infolog ?

    I Daniel

    As I understand you want to store every infolog which is generated in system.

    You have to overwrite the infolog.add() method. There you get the infolog information by arguments. Now you can insert a record in your own created infologstore table.

    Do you know what I mean?

  • Re: How can we get text from infolog ?

    Hello Daniel,

    Thanks for your response but this solution doest not ok :(

    Do you know what can I do ?

  • Re: How can we get text from infolog ?

    Have a look at SysTestResult.endTest().  It uses a listener to store the InfoLog.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans