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

Default to UTF-8 in /var/log/cloud-init.log #427

Merged
merged 2 commits into from Jun 12, 2020

Conversation

TheRealFalcon
Copy link
Member

On a system with a non-utf8 default locale, the logger will silently not log anything if the message contains an unsupported character.

Specifically on Xenial, in the cloud-init process

import locale
print(locale.getpreferredencoding())

returns ANSI_X3.4-1968.

Interesting to note, running the same code on the CLI after cloud-init has completed returns UTF-8.

The StreamLogger (i.e., the stdout/stderr logger) suffers from the same problem, but there's no (non-hacky) way to alter its encoding.

On a system with a non-utf8 default locale, the logger will silently
not log anything if the message contains an unsupported character.
@smoser
Copy link
Collaborator

smoser commented Jun 12, 2020

Kind of just for reference... LP: #1751051.

The world is a strange place before there is a system locale set. That is the world in which you're first opening the log.

I'm sorry if this isn't relevant information, but it felt like it might be.

@OddBloke
Copy link
Collaborator

@smoser Agreed that it's a weird world at this point, and thanks for the context; I double-checked with Steve Langasek and he also couldn't think of a reason to not open it in UTF-8.

Copy link
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@OddBloke OddBloke merged commit 287bfca into canonical:master Jun 12, 2020
Copy link
Contributor

@xnox xnox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants