GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ColoredConsoleAppender writes UTF-8 preamble to the console on initialization · Issue #168 · apache/logging-log4net

ColoredConsoleAppender writes UTF-8 preamble to the console on initialization #168

New issue
Copy link
New issue
Copy link
Closed
Closed
ColoredConsoleAppender writes UTF-8 preamble to the console on initialization#168
Copy link
Assignees
FreeAndNil
Labels
bug
Milestone
3.0.0

Description

@RoboBurned
RoboBurned
opened on Aug 13, 2024
Issue body actions

I have an issue with ColoredConsoleAppender on WIndows 10.
After initialization it prints an extra "space" to the console at the very beginning.
It writes the preamble of UTF-8 encoding that results in a visual "space" in windows console.

After debugging I found that it happens in ActivateOptions function when setting AutoFlush property of StreamWriter to true.

logging-log4net/src/log4net/Appender/ColoredConsoleAppender.cs

Line 467 in ad0180f

m_consoleOutputWriter.AutoFlush = true;

If you look at sources of Console.WriteLine method, they set HaveWrittenPreamble property to true to bypass writing it by streamwriter. That's why they have no such issue.
https://referencesource.microsoft.com/#mscorlib/system/console.cs,373

Activity

  1. FreeAndNil
    added a commit that references this issue on Aug 15, 2024

    #168 wrap encoding in ColoredConsoleAppender for skipping preamble

    ede020b
  2. FreeAndNil commented on Aug 15, 2024

    @FreeAndNil
    FreeAndNil
    on Aug 15, 2024
    Contributor
    More actions

    Hi @RoboBurned ,

    can you check whether log4net.3.0.0-preview.2b.zip fixes your problem?

    Reacted by Robo Burned
  3. FreeAndNil
    added 2 commits that reference this issue on Aug 16, 2024

    #168 wrap encoding in ColoredConsoleAppender for skipping preamble

    5b0116b

    #168 added tests for LevelMapping

    2a7683c
  4. RoboBurned commented on Aug 17, 2024

    @RoboBurned
    RoboBurned
    on Aug 17, 2024
    Author
    More actions

    @FreeAndNil Yes, the version you provided fixes the issue for me. Thank you.

  5. FreeAndNil
    added
    bug
    on Aug 18, 2024
  6. FreeAndNil
    added this to the 3.0.0 milestone on Aug 18, 2024
  7. FreeAndNil
    self-assigned this
    on Aug 18, 2024
  8. FreeAndNil commented on Aug 18, 2024

    @FreeAndNil
    FreeAndNil
    on Aug 18, 2024
    Contributor
    More actions

    @RoboBurned Thanks for testing, will be fixed in 3.0.0-Preview.3.

  9. FreeAndNil
    closed this as completedon Aug 18, 2024
  10. FreeAndNil
    added 2 commits that reference this issue on Aug 18, 2024

    #168 added release notes

    62aa1e8

    Merge pull request #172 from apache/Feature/170-ColoredConsoleAppender

    4c2ed96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @FreeAndNil
    FreeAndNil

Labels

bug

Type

No type

Projects

No projects

    Milestone

    • 3.0.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.