dotnet / dotnet/docker-tools

Add structured logging to ImageBuilder

Open
#1,908 0 comments 0 reactions 0 assignees View on GitHub
area-infrastructure
Dominant language
C#
Stars
181
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
10

Description

Adding structured logging to ImageBuilder would allow us to analyze log outputs and operate on log data using `jq` or other tools.

I propose that we split ImageBuilder's logging into two components:

- High-level console logging that is concise (fits on ~one terminal screen) and easily parsable by humans and LLMs.
- Detailed structured logging in json that is output to a file and published as a pipeline artifact. One log per ImageBuilder invocation. Put each log file into one folder and upload one log artifact per pipeline job.

Microsoft.Extensions.Logging does not have file logging support natively. See https://github.com/dotnet/runtime/issues/59322. There are a couple libraries that can provide this functionality through M.E.Logging.Abstractions (using ILogger) - both are popular and in active development:

- [Serilog](https://www.nuget.org/packages/Serilog) (~2B downloads)
- [NLog](https://www.nuget.org/packages/NLog) (~500M downloads)

[NLog version 6](https://nlog-project.org/2025/06/21/nlog-6-0-released.html) fully supports Native AOT/trimming so I lean towards that one.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.