Incorrectly encoded logger output #570

Open
opened 2025-12-29 15:27:14 +01:00 by adam · 10 comments
Owner

Originally created by @cezarypiatekGC on GitHub (Jan 30, 2024).

Describe the bug

The Wiremock console logger does not encode newline characters in the output. This causes problems with the log shipping mechanisms.

Expected behaviour:

I am using the WireMock.Net docker image to test my services within the K8s cluster. Because the output is formatted incorrectly, the log shipping mechanism treats each line as a separate log entry, resulting in a huge amount of log entries that are completely corrupted.

Below is the output from the Rancher console. As you can see, each line of formatted json is treated as a separate log entry:
image

Originally created by @cezarypiatekGC on GitHub (Jan 30, 2024). ### Describe the bug The Wiremock console logger does not encode newline characters in the output. This causes problems with the log shipping mechanisms. ### Expected behaviour: I am using the WireMock.Net docker image to test my services within the K8s cluster. Because the output is formatted incorrectly, the log shipping mechanism treats each line as a separate log entry, resulting in a huge amount of log entries that are completely corrupted. Below is the output from the Rancher console. As you can see, each line of formatted json is treated as a separate log entry: ![image](https://github.com/WireMock-Net/WireMock.Net/assets/52414058/f1a6aee0-0138-4f19-ba0d-06b49b4d9095)
adam added the bug label 2025-12-29 15:27:14 +01:00
Author
Owner

@StefH commented on GitHub (Jan 30, 2024):

https://github.com/WireMock-Net/WireMock.Net/pull/1063

@StefH commented on GitHub (Jan 30, 2024): https://github.com/WireMock-Net/WireMock.Net/pull/1063
Author
Owner

@StefH commented on GitHub (Jan 30, 2024):

Hello @cezarypiatekGC,

To be backwards compatible, I've added a boolean param to the WireMockConsoleLogger.

And I've updated the testcontainers nuget to use this logger WireMockNoNewLinesConsoleLogger.

And I'll also update the docker project to use this logger by default.

@StefH commented on GitHub (Jan 30, 2024): Hello @cezarypiatekGC, To be backwards compatible, I've added a boolean param to the WireMockConsoleLogger. And I've updated the testcontainers nuget to use this logger `WireMockNoNewLinesConsoleLogger`. And I'll also update the docker project to use this logger by default.
Author
Owner

@cezarypiatekGC commented on GitHub (Jan 31, 2024):

Looks like the PR pipeline failed, please let me know when the new image is released.

@cezarypiatekGC commented on GitHub (Jan 31, 2024): Looks like the PR pipeline failed, please let me know when the new image is released.
Author
Owner

@StefH commented on GitHub (Jan 31, 2024):

Looks like the PR pipeline failed, please let me know when the new image is released.

Should be fixed now, you can try the latests preview version.

@StefH commented on GitHub (Jan 31, 2024): > Looks like the PR pipeline failed, please let me know when the new image is released. Should be fixed now, you can try the latests preview version.
Author
Owner

@StefH commented on GitHub (Feb 8, 2024):

@cezarypiatekGC
Did you try the latest preview version?

@StefH commented on GitHub (Feb 8, 2024): @cezarypiatekGC Did you try the latest preview version?
Author
Owner

@cezarypiatekGC commented on GitHub (Feb 9, 2024):

What's the tag for preview?

@cezarypiatekGC commented on GitHub (Feb 9, 2024): What's the tag for preview?
Author
Owner

@StefH commented on GitHub (Feb 9, 2024):

1.5.47-ci-18350

@StefH commented on GitHub (Feb 9, 2024): 1.5.47-ci-18350
Author
Owner

@cezarypiatekGC commented on GitHub (Feb 9, 2024):

Can't download it from docker hub. Is it publish via different channel?

@cezarypiatekGC commented on GitHub (Feb 9, 2024): Can't download it from docker hub. Is it publish via different channel?
Author
Owner

@StefH commented on GitHub (Feb 9, 2024):

Can't download it from docker hub. Is it publish via different channel?

Sorry. I understand now. I did only update the NuGet and the TestContainer NuGet.

If you can review the PR? And if the PR looks good, I'll merge to main and create new official Nuget and create new Docker.

@StefH commented on GitHub (Feb 9, 2024): > Can't download it from docker hub. Is it publish via different channel? Sorry. I understand now. I did only update the NuGet and the TestContainer NuGet. If you can review the PR? And if the PR looks good, I'll merge to main and create new official Nuget and create new Docker.
Author
Owner

@cezarypiatekGC commented on GitHub (Feb 9, 2024):

Not sure if removing line-endings is a solution here. After shipping logs to store like ElasticSearch they will be unreadable. How do the professional loggers like NLog and SeriLog handle such case?

@cezarypiatekGC commented on GitHub (Feb 9, 2024): Not sure if removing line-endings is a solution here. After shipping logs to store like ElasticSearch they will be unreadable. How do the professional loggers like NLog and SeriLog handle such case?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#570