You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/sql/how-to-configure-cosmos-db-trigger.md
+23-4Lines changed: 23 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to configure logging and connection policy used by Azure
4
4
author: ealsur
5
5
ms.service: cosmos-db
6
6
ms.topic: how-to
7
-
ms.date: 10/04/2021
7
+
ms.date: 05/09/2022
8
8
ms.author: maquaran
9
9
---
10
10
@@ -17,7 +17,7 @@ This article describes advanced configuration options you can set when using the
17
17
18
18
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).
19
19
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.
21
21
22
22
### Enabling logging
23
23
@@ -29,13 +29,32 @@ To enable logging when using Azure Functions trigger for Cosmos DB, locate the `
29
29
"logging": {
30
30
"fileLoggingMode":"always",
31
31
"logLevel": {
32
-
"Host.Triggers.CosmosDB":"Trace"
32
+
"Host.Triggers.CosmosDB":"Warning"
33
33
}
34
34
}
35
35
}
36
36
```
37
37
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.
0 commit comments