Bug #6249
openlogging: ANSI color sequences should be reset after log message
100%
Description
Currently, libosmocore will output color control escape sequences to print logs in a specific color.
When logging these messages to something mixed with other messages (like systemd-journald), the missing reset at the end of the message causes output like this:
Proposed fix: Output a color reset at the end of each log message. This adds 4 bytes (escape, [0m) at the end of each message, which IMHO is reasonable.
Files
Related issues
Updated by manawyrm 6 months ago
Yes, I had a brief look at the code and there is indeed code to reset the colors after each block/message.
Not quite sure why/where the last reset is getting lost.
Could you maybe tell me about the expected behaviour? I'm guessing the text itself shouldn't be coloured at all?
Updated by laforge 6 months ago
On Tue, Nov 07, 2023 at 10:37:56AM +0000, manawyrm wrote:
Could you maybe tell me about the expected behaviour? I'm guessing the text itself shouldn't be coloured at all?
that all depends on your log configuration. It supports a large variety of modes. In the
default mode, indeed the whole line would be colored according to the sub-system log color. Each subsystem
uses a different color.
Updated by manawyrm 6 months ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset libosmocore|11a416827dd9f2da6b7c1db0e1e83adb1e6e5cc8.
Updated by neels 5 months ago
The patch
https://osmocom.org/projects/libosmocore/repository/libosmocore/revisions/11a416827dd9f2da6b7c1db0e1e83adb1e6e5cc8/diff
causes a bug:
https://osmocom.org/issues/6284 "'\0' in log output" (almost all osmo cni programs)
I don't understand why yet, but reverting the patch fixes the issue.