MscrmTools.Xrm.Connection icon indicating copy to clipboard operation
MscrmTools.Xrm.Connection copied to clipboard

Logging getting metadata

Open rappen opened this issue 5 months ago • 4 comments

@MarkMpn - Can we log a bit of what we are going through the steps during the process of getting the metadata? If so, then we can get more details on how much time it takes and in which parts of the steps... Calling LogInfo during the normal process, LogWarning when it cannot interpret the version stamp, and, of course, calling LogError when something unexpected happens.

@MscrmTools - Is there a setting (visible in the UI or only in the settings file) to select which logs are actually stored? Error/Warning/Info/Verbose...

rappen avatar Jul 19 '25 08:07 rappen

No problem adding some logging, but where should they go? The LogManager class you'd use from a tool isn't available from the connection library. I could create a new .log file next to the existing .json.gz cache file? I can't see an easy way of managing those logs either, so there's a risk they'll just keep growing over time.

I could expose a new property to control the log path and select the logging level and some methods to help tidy up old logs and then add them into the UI in the main XrmToolBox project, but wonder if that's making things too complicated?

MarkMpn avatar Jul 19 '25 19:07 MarkMpn

You've got a point... or three. I have no better suggestion. Maybe we should just close this issue or wait to see if @MscrmTools has some ideas first.

rappen avatar Jul 20 '25 09:07 rappen

I can definitively add a setting for logging in XrmToolBox but metadata are in connection controls. So I should start with enabling log levels there before adding it in XrmToolBox

MscrmTools avatar Jul 20 '25 09:07 MscrmTools

ok @MarkMpn, I added a LogManager in MscrmTools.Xrm.Connection library.

You can use it passing a filename new LogManager("metadatacache.log")

MscrmTools avatar Jul 22 '25 07:07 MscrmTools