Skip to content

Commit 2cff830

Browse files
authored
Merge pull request #197596 from ealsur/users/ealsur/triggerlogs
Cosmos DB: Trigger log details
2 parents 72451cd + 215a0f9 commit 2cff830

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

articles/cosmos-db/sql/how-to-configure-cosmos-db-trigger.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to configure logging and connection policy used by Azure
44
author: ealsur
55
ms.service: cosmos-db
66
ms.topic: how-to
7-
ms.date: 10/04/2021
7+
ms.date: 05/09/2022
88
ms.author: maquaran
99
---
1010

@@ -17,7 +17,7 @@ This article describes advanced configuration options you can set when using the
1717

1818
The Azure Functions trigger for Cosmos DB uses the [Change Feed Processor Library](change-feed-processor.md) internally, and the library generates a set of health logs that can be used to monitor internal operations for [troubleshooting purposes](./troubleshoot-changefeed-functions.md).
1919

20-
The health logs describe how the Azure Functions trigger for Cosmos DB behaves when attempting operations during load-balancing scenarios or initialization.
20+
The health logs describe how the Azure Functions trigger for Cosmos DB behaves when attempting operations during load-balancing, initialization, and processing scenarios.
2121

2222
### Enabling logging
2323

@@ -29,13 +29,32 @@ To enable logging when using Azure Functions trigger for Cosmos DB, locate the `
2929
"logging": {
3030
"fileLoggingMode": "always",
3131
"logLevel": {
32-
"Host.Triggers.CosmosDB": "Trace"
32+
"Host.Triggers.CosmosDB": "Warning"
3333
}
3434
}
3535
}
3636
```
3737

38-
After the Azure Function is deployed with the updated configuration, you will see the Azure Functions trigger for Cosmos DB logs as part of your traces. You can view the logs in your configured logging provider under the *Category* `Host.Triggers.CosmosDB`.
38+
After the Azure Function is deployed with the updated configuration, you'll see the Azure Functions trigger for Cosmos DB logs as part of your traces. You can view the logs in your configured logging provider under the *Category* `Host.Triggers.CosmosDB`.
39+
40+
### Which type of logs are emitted?
41+
42+
Once enabled, there are three levels of log events that will be emitted:
43+
44+
* Error:
45+
* When there's an unknown or critical error on the Change Feed processing that is affecting the correct trigger functionality.
46+
47+
* Warning:
48+
* When your Function user code had an unhandled exception - There's a gap in your Function code and the Function isn't [resilient to errors](../../azure-functions/performance-reliability.md#write-defensive-functions) or a serialization error (for C# Functions, the raw json can't be deserialized to the selected C# type).
49+
* When there are transient connectivity issues preventing the trigger from interacting with the Cosmos DB account. The trigger will retry these [transient connectivity errors](troubleshoot-dot-net-sdk-request-timeout.md) but if they extend for a long period of time, there could be a network problem. You can enable Debug level traces to obtain the Diagnostics from the underlying Cosmos DB SDK.
50+
51+
* Debug:
52+
* When a lease is acquired by an instance - The current instance will start processing the Change Feed for the lease.
53+
* When a lease is released by an instance - The current instance has stopped processing the Change Feed for the lease.
54+
* When new changes are delivered from the trigger to your Function code - Helps debug situations when your Function code might be having errors and you aren't sure if you're receiving changes or not.
55+
* For traces that are Warning and Error, adds the Diagnostics information from the underlying Cosmos DB SDK for troubleshooting purposes.
56+
57+
You can also [refer to the source code](https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerHealthMonitor.cs) to see the full details.
3958

4059
### Query the logs
4160

0 commit comments

Comments
 (0)