Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

When using the SDK, we see the dependency call to the dataverse like so

image

But as you can see, it doesn't tell us what it is actually doing in that call. Is it querying data, or updating data etc.

Is there any quick and easy way to log extra information out, like the Fetch XML included in the query. I'm looking for an out of the box way to do it with the SDK rather than rolling my own for now.

You must be logged in to vote

In your case, the logger you're passing in is assigned a log level, this is the level that logs will reported to whatever write sink you have attached to the logger. I misused the term "channel" in-place of LogLevel ( I think of these has channels as they can be handled independently, sorry for the confusion there).
Full documentation on Ilogger is here

the Dataverse ServiceClient, when executing the statement you have above will log the following on the Trace LogLevel:

Execute Command - RetrieveMultiple : Execute (RetrieveMultiple) request to Dataverse from IOrganizationService : RequestID=d6e9b544-5c06-45c8-8bb7-de1f2302deb5

when it starts and

Executed Command - RetrieveMultiple : Exec…

Replies: 1 comment · 3 replies

Comment options

Yes,
if you wire in the ilogger and listen to the trace channel you will see things like this:
Execute Command - WhoAmI : Execute (WhoAmI) request to Dataverse from IOrganizationService : RequestID=d6e9b544-5c06-45c8-8bb7-de1f2302deb5
Executed Command - WhoAmI : Execute (WhoAmI) request to Dataverse from IOrganizationService : RequestID=d6e9b544-5c06-45c8-8bb7-de1f2302deb5 : duration=00:00:01.0352221

This message changes depending on if a session ID is present or not, and the type of message being sent.

Additionally if you use the "ExecuteOrganizationRequest" extension, you can pass your own message that will be tagged in this log.

You must be logged in to vote
3 replies
@Gareth064
Comment options

Hey

This is how I wire up the ServiceClient

serviceClient = new ServiceClient(appUri, appD365ClientId, appD365ClientSecret, false, logger);

Not sure what you mean by channel

Then I make calls like so.

    public async Task<EntityCollection> RetrieveMultipleAsync(QueryExpression qe)
    {
        try
        {
            var result = await ((ServiceClient)client).RetrieveMultipleAsync(qe);

            return result;
        }
        catch (Exception)
        {
            throw;
        }
    }

Where would I add the extra logging? That RetrieveMultipleAsync appears to call "ExecuteOrganizationRequest" in its code behind.

@MattB-msft
Comment options

In your case, the logger you're passing in is assigned a log level, this is the level that logs will reported to whatever write sink you have attached to the logger. I misused the term "channel" in-place of LogLevel ( I think of these has channels as they can be handled independently, sorry for the confusion there).
Full documentation on Ilogger is here

the Dataverse ServiceClient, when executing the statement you have above will log the following on the Trace LogLevel:

Execute Command - RetrieveMultiple : Execute (RetrieveMultiple) request to Dataverse from IOrganizationService : RequestID=d6e9b544-5c06-45c8-8bb7-de1f2302deb5

when it starts and

Executed Command - RetrieveMultiple : Execute (RetrieveMultiple) request to Dataverse from IOrganizationService : RequestID=d6e9b544-5c06-45c8-8bb7-de1f2302deb5 : duration=00:00:01.0352221

when it completes. this allows you to see the start and end of the request along with the duration.

If you used "ExecuteOrganizationRequest( , )" you can add a custom tag to each log event written to trace. To see ExecuteOrganziationRequest you need to add Microsoft.PowerPlatform.Dataverse.Client.Extensions namespace.

Does that help?

Answer selected by MattB-msft
@Gareth064
Comment options

Thank you for your advice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.