Ir al contenido

Duplicate log message (ARCH1009)

Esta página aún no está disponible en tu idioma.

Key dotnet.logging.duplicate-log-message · Severity info · Category logging · Principle Dry

Repeating the exact same log message in the same class makes it impossible to tell which path an event came from in the logs. Keep messages unique.

public void Create() => _logger.LogInformation("Operation completed");
public void Update() => _logger.LogInformation("Operation completed");
public void Create() => _logger.LogInformation("Create completed");
public void Update() => _logger.LogInformation("Update completed");

Make each log message specific to its operation, or add distinguishing context parameters so the messages are unique.