web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Is Infolog an alias to the class Info?

(0) ShareShare
ReportReport
Posted on by 95

I am trying to understand how Infolog works within Dynamics AX. I understand that Info("Hello World!") will display the text in the infolog window. I am aware that info is a static method on the Global class and therefore the method can be called by simply calling the name without actually specifying Global::

While looking into the method info in class Global, I noticed that it invokes infolog.add. Right-clicking on add and selecting the option Lookup Definition takes me to the method add in the class Info. 

If the class in which the method add exists is named as Info, how is it being called from within Global::info() with the name Infolog? The only logical conclusion that I can arrive at is that Infolog is an alias for the class Info. If that is correct, where is this defined? I tried searching the AOT but found multiple references to the term Infolog but I couldn't find anything that would directly relate to an Application or System class.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You missed one important point - Info.add() is an instance method, therefore "infolog" in infolog.add() must be a variable, not a type alias. And that's how it works - infolog is a truly global variable holding an instance of the Info class.

  • codeyuga Profile Picture
    95 on at

    Sorry, did you mean to say that info.add() is an instance method? The method add in the class Info is not declared as static.

    Yes, it does make sense that infolog used inside Global::info() is a global variable of the class Info. Thanks for your response.

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Yes, it's an *instance* method, of course. Sorry for the confusion. (I fixed it in the original post.)

    Fortunately you deciphered it anyway. :-)

  • codeyuga Profile Picture
    95 on at

    Based on your response I debugged the code further and this is what I found.

    Below shown code is from the static method Global::info(). As you had pointed out, I failed to notice that call to method add using the object infolog is actually an instance method and not static.

    client server static Exception info(
        SysInfoLogStr txt, 
        URL helpUrl = '', 
        SysInfoAction _sysInfoAction = null)
    {
        return infolog.add(Exception::Info, 
            getPrefix()+txt, 
            helpUrl, 
            _sysInfoAction, false);
    }
    

    In other words, infolog is an instance of class Info. After looking into the class Info, I found the startup method. I kept a breakpoint to debug the code and found that this method is called whenever the AX client is opened. This method in turn calls another method named initBrowser. Within theinitBrowser, the following code seems to initialize the global instance of Infolog using a windows handle.

    this.initializeInfolog(this.browser().hWnd());
    

    The above menthod initializeInfolog exists in the System class xInfo, which is the parent class of Info. Since I cannot look into the class xInfo, I assume that this is where the instance of class Info with the name infolog is being created.

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans