I have an AX 2012 requirement to log events that are currently happening in several classes and methods for several business processes.
Current implementation for existing functionality is using macros to define the name of the class and method:
This pattern becomes a pain when you have to do this same process across hundreds of methods, take care that Class name and Method names are not misspelled or even worst, you copy paste the wrong names into the wrong places.
The solution I followed was, instead of using macros, use the funcName() function, that basically retrieves a string with the Class and Method, split values into a container and read them wherever needed:
Implementation of new created function is as follows: