---
title: "How to log Polly strategy events and telemetry in .NET applications?"  
description: "How to log Polly strategy events and telemetry in .NET applications?"  
author: "Uttam Misra"  
published: 2026-08-14  
updated: 2026-08-14  
canonical: https://answers.mindstick.com/qa/117061/how-to-log-polly-strategy-events-and-telemetry-in-net-applications  
category: "Polly"  
tags: ["csharp", "dotnet", "polly", "logging", "telemetry"]  
reading_time: 1 minute  

---

# How to log Polly strategy events and telemetry in .NET applications?

Monitoring when resilience policies trigger—such as retry attempts or open circuit breakers—is crucial for observability in modern cloud applications.

## Logging Strategy Events

In Polly v8, strategies expose lifecycle events like `OnRetry`, `OnBreak`, and `OnTimeout` that attach to `ILogger`.

### Code Example

```
var pipeline = new ResiliencePipelineBuilder()
    .AddRetry(new RetryStrategyOptions
    {
        MaxRetryAttempts = 3,
        Delay = TimeSpan.FromSeconds(1),
        OnRetry = args =>
        {
            Console.WriteLine($"Retry attempt {args.AttemptNumber} after exception: {args.Outcome.Exception?.Message}");
            return ValueTask.CompletedTask;
        }
    })
    .ConfigureTelemetry(new TelemetryOptions
    {
        LoggerFactory = loggerFactory
    })
    .Build();
```


---

Original Source: https://answers.mindstick.com/qa/117061/how-to-log-polly-strategy-events-and-telemetry-in-net-applications

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
