Log level (ARCH1005)
Esta página aún no está disponible en tu idioma.
Key dotnet.logging.log-level · Severity info · Category logging
Using LogInformation for error conditions makes failures hard to track and warnings hard to filter. Choose the level that matches the context.
Incorrect
Section titled “Incorrect”catch (Exception ex){ _logger.LogInformation(ex, "Database connection failed");}Correct
Section titled “Correct”catch (Exception ex){ _logger.LogError(ex, "Database connection failed");}Use LogError for errors, LogWarning for warnings, and LogDebug for detailed traces so the level matches the context.