Skip to content

Integrate ConsoleLogExporter functionality from dotnet/extensions #87250

Closed as not planned

Description

@noahfalk

We'd like to eliminate https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.Telemetry.Console/Logging/LoggingConsoleExporter.cs. Martin wants to bring some functionality over to the inbox console logger concurrently. We need to identify what that functionality is.

Activity

  1. added this to the 8.0.0 milestone on Jun 8, 2023
  2. added
    partner-impact
    on Jun 8, 2023
  3. tarekgh commented on Jun 8, 2023

    @tarekgh
    Member

    @geeknoid can you please add more details about bringing these to the runtime? I am seeing these are currently internal in the extension's repo. Why can't these stay there? Thanks!

  4. geeknoid commented on Jun 13, 2023

    @geeknoid
    Member

    Sorry for the late follow-up. The differences between what we have in dotnet/extensions vs. what's already in the platform is reflected through the options, which I pasted below. The dotnet/extesnions design was created to provide a first class experience for developers using the console in every day work. But in brief:

    • Support for outputting log entry dimensions

    • Control over which parts of log messages to output (IncludeLogLevel, IncludeTimeStamp, IncludeCategory, IncludeSpanId, IncludeTraceId, IncludeDimensions, IncludeExceptionStackTrace)

    • Control over color output (the *Color properties).

    public class LoggingConsoleOptions
    {
        /// <summary>
        /// Gets or sets a value indicating whether to display scopes.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool IncludeScopes { get; set; } = true;
    
        /// <summary>
        /// Gets or sets the format string used to format timestamps in logging messages.
        /// </summary>
        /// <value>
        /// Defaults to <c>yyyy-MM-dd HH:mm:ss.fff</c>.
        /// </value>
        public string? TimestampFormat { get; set; } = "yyyy-MM-dd HH:mm:ss.fff";
    
        /// <summary>
        /// Gets or sets a value indicating whether or not UTC timezone should be used for timestamps in logging messages.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="false"/>.
        /// </value>
        public bool UseUtcTimestamp { get; set; }
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the timestamp.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool IncludeTimestamp { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the log level.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool IncludeLogLevel { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the category.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool IncludeCategory { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the stack trace.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool IncludeExceptionStacktrace { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the activity TraceId.
        /// </summary>
        /// <value>
        /// The default value is <see langword="true"/>.
        /// </value>
        public bool IncludeTraceId { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether to display the activity SpanId.
        /// </summary>
        /// <value>
        /// The default value is <see langword="true"/>.
        /// </value>
        public bool IncludeSpanId { get; set; } = true;
    
        /// <summary>
        /// Gets or sets a value indicating whether colors are enabled or not.
        /// </summary>
        /// <value>
        /// Defaults to <see langword="true"/>.
        /// </value>
        public bool ColorsEnabled { get; set; } = true;
    
        /// <summary>
        /// Gets or sets the color to use for dimmed text.
        /// </summary>
        /// <value>Defaults to <see cref="ConsoleColor.DarkGray"/>.</value>
        public ConsoleColor DimmedColor { get; set; } = ConsoleColor.DarkGray;
    
        /// <summary>
        /// Gets or sets the color to use for dimmed text background.
        /// </summary>
        public ConsoleColor? DimmedBackgroundColor { get; set; }
    
        /// <summary>
        /// Gets or sets the color to use for exception text.
        /// </summary>
        /// <value>Defaults to <see cref="ConsoleColor.Red"/>.</value>
        public ConsoleColor ExceptionColor { get; set; } = ConsoleColor.Red;
    
        /// <summary>
        /// Gets or sets the color to use for exception text background.
        /// </summary>
        public ConsoleColor? ExceptionBackgroundColor { get; set; }
    
        /// <summary>
        /// Gets or sets the color to use for exception stack trace text.
        /// </summary>
        /// <value>Defaults to <see cref="ConsoleColor.DarkRed"/>.</value>
        public ConsoleColor ExceptionStackTraceColor { get; set; } = ConsoleColor.DarkRed;
    
        /// <summary>
        /// Gets or sets the color to use for exception stack trace text background.
        /// </summary>
        public ConsoleColor? ExceptionStackTraceBackgroundColor { get; set; }
    
        /// <summary>
        /// Gets or sets a value indicating whether to include dimension name/value pairs with each log record.
        /// </summary>
        /// <value>Defaults to <see langword="false"/>.</value>
        public bool IncludeDimensions { get; set; }
    
        /// <summary>
        /// Gets or sets the color to use for dimension text.
        /// </summary>
        /// <value>Defaults to <see cref="ConsoleColor.DarkGreen"/>.</value>
        public ConsoleColor DimensionsColor { get; set; } = ConsoleColor.DarkGreen;
    
        /// <summary>
        /// Gets or sets the color to use for dimension text background.
        /// </summary>
        public ConsoleColor? DimensionsBackgroundColor { get; set; }
    }
  5. tarekgh commented on Jun 13, 2023

    @tarekgh
    Member

    Edited
    I think you meant ConsoleFormatterOptions and not LoggingConsoleOptions.

    For trace/span ids we already have ActivityTrackingOptions

  6. geeknoid commented on Jun 14, 2023

    @geeknoid
    Member

    Note that the console logging feature from dotnet/extensions is being removed as of this PR: dotnet/extensions#4076. This is to eliminate redundancy, so we don't have N console loggers floating around.

    When it comes time to implement this functionality, please go dig into the history of the extensions repo for reference.

  7. modified the milestones: 8.0.0, Future on Jun 18, 2023
  8. geeknoid commented on Dec 21, 2023

    @geeknoid
    Member

    @joperezr This is the item I mentioned would be important to do in support of structured logging. Otherwise, an app using structured logging sees nothing coming out on the console during development.

  9. removed their assignment
    on Dec 21, 2023
  10. modified the milestones: Future, 9.0.0 on Jan 9, 2024
  11. modified the milestones: 9.0.0, Future on Jun 25, 2024
  12. modified the milestones: Future, 11.0.0 on Feb 10, 2026
  13. rosebyte commented on Feb 10, 2026

    @rosebyte
    Member

    Triage: The package seems working all fine in dotnet/extensions, we might have missed something, however, we don't see a strong reason to move it to dotnet/runtime. It's true we now have multiple implementations but we will have to keep supporting the dotnet/extensions version anyway now.

  14. locked and limited conversation to collaborators on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Extensions-Loggingpartner-impact

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions