Skip to content

Structured Logging - Refactor logging statements to address CA2254 #1517

@aaronpowell

Description

@aaronpowell

Currently we have a lot of CA2254 warnings in the codebase due to how we generate log messages.

Here's an example:

_logger.LogInformation($"Using merged config file based on environment:{configToBeUsed}.");

The issue is that we're not using log templates which enable better structured logging.

Ideally, the code should be:

_logger.LogInformation("Using merged config file based on environment:{configToBeUsed}.", configToBeUsed);

NLog has a good overview on structured logging.

This issue is to track the codebase-wide refactor.

### Tasks
- [ ] https://github.com/Azure/data-api-builder/pull/1594
- [x] remove dupe exception logging
- [x] update service/config project
- [x] update core project

Metadata

Metadata

Assignees

Labels

backlogbugSomething isn't workingusabilityMake the APIs more user friendly with better exceptions

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions