Let’s talk about logs in Dynamics 365 Finance and Operations. And I don’t mean the built-in database logs we’ve had since the old Axapta days. I’m talking about plain logs, a table and a form to see how/why data is changing, or logging external calls to OData or custom web services endpoints in the ERP.
It’s something that I’m sure almost all developers at some point have had to do. The customer wants to record CRUD events, you suggest enabling the DB log, but the customer wants a new form to see the data. Or maybe you’re monitoring all the calls to your custom web services.
It’s time to stop doing this, or at least to change how we do it.
It’s been a bit over 6 years since Microsoft released Dynamics AX7 in 2016. During this time we’ve gone through some name changes. And all of those who were already working with AX 2009 or AX 2012 have had to go through some habit changes too.
We’re slowly shifting to a true SaaS model for Finance and Operations, and one of the features of SaaS is that you pay for a specific amount of services. And this includes database space. This is something our CRM/Power Platform/Dataverse colleagues know much better than us.
If you check the Dynamics 365 licensing guide (I hope this will be the only time I write about licensing) you can see that the Finance and Operations database has a limited assigned amount of space:
Yes, that’s right, only 20 GB of base DB capacity, plus extra capacity per each user license. And everything that exceeds that capacity will be billed. I haven’t found the price in the latest version of the licensing guide, but the last time I saw it, it was like €40/GB. But I haven’t heard of anyone being billed yet.
This means that we need to be careful regarding what we create in the ERP. And for me, one of the things we need to do is getting rid of logs inside Dynamics 365 F&O.
What to use instead? That’s up to you, but there are plenty of options without going outside the Microsoft ecosystem. And of course for a fraction of the price you’d pay for a single GB of extra DB capacity.
Azure Application Insights
Azure Application Insights is a feature that is integrated with a lot of other Azure tools like API Management to help monitor them. It’s also being slowly built into some parts of Dynamics 365 F&O. Right now, there’s a preview feature for Commerce Scale Unit.
It’s now part of…
Azure Monitor is a bigger and more complete (and complex) solution for monitoring. If you’re already using it, you could integrate your Dynamics 365 logs here, but otherwise I wouldn’t choose it as the first option when creating logs.
And of course we also have old-style file-based logs, which could also be the cheapest solution using Azure Blob Storage. Of course, file-based logs aren’t the easiest to read, but there’s plenty of software that helps with that.
Whatever is the solution you choose, even if it’s none of the above, the way of implementing it should be more or less the same, and deciding which data you want to log and which format this log will have should be your first steps.
Then, depending on which log tools you’re going to use, you’ll need to create some kind of API to send the data to that service.
A final thought
I’ve been thinking about this a lot lately. And also about putting an API Management in front of each Dynamics 365 instance. A lot. This could be another step towards a real cloud ERP that takes advantage of being hosted in Azure and uses more of the tools it has.
Is it extra work? Yes, it is. Is this extra work worth the effort? In my opinion, it is.
The APIM made me realize the logging thing. When you configure an APIM you can enable Application Insights. Then you can track the requests that get to the APIM, the request that goes into Dynamics 365, the response from Dynamics 365 to the APIM and the response from the APIM to the caller. And have complete detail of every step!
So, why not doing the same when logging things inside Dynamics 365? I think that knowing why something is going wrong is important, and that’s why we sometimes need logs, and using tools like Application Insights that have far more capacities than a D365 table and form is a much better idea.