Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
RoboBurned opened this issue Aug 13, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@RoboBurned
Copy link

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.

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

@FreeAndNil
Copy link
Contributor

Hi @RoboBurned ,

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

@RoboBurned
Copy link
Author

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

@FreeAndNil FreeAndNil added the bug label Aug 18, 2024
@FreeAndNil FreeAndNil added this to the 3.0.0 milestone Aug 18, 2024
@FreeAndNil FreeAndNil self-assigned this Aug 18, 2024
@FreeAndNil
Copy link
Contributor

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

FreeAndNil added a commit that referenced this issue Aug 18, 2024
FreeAndNil added a commit that referenced this issue Aug 18, 2024
#168 wrap encoding in ColoredConsoleAppender for skipping preamble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants