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

feat(config): Allow setting log format from envar #4484

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

szechyjs
Copy link
Contributor

@szechyjs szechyjs commented Feb 3, 2025

There is a large discontinuity between config values that can be set in environment variables. When running in containers the prefered config approach is through environment variables and not config files. This PR enables setting of the logging format through an environment variable

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@szechyjs szechyjs requested a review from a team as a code owner February 3, 2025 18:28
@Dav1dde Dav1dde changed the title Allow setting log format from envar feat(config): Allow setting log format from envar Feb 3, 2025
@Dav1dde
Copy link
Member

Dav1dde commented Feb 3, 2025

@szechyjs thanks for the PR, I went ahead and fixed a small issue with a missing cli arg and added a changelog entry.

I also found that --log-level does not work when passed via cli (it does via env var)... Something to investigate separetely.

@Dav1dde
Copy link
Member

Dav1dde commented Feb 3, 2025

Gonna merge tomorrow, wanna check CI first and I am hungry now^^.

@szechyjs
Copy link
Contributor Author

szechyjs commented Feb 3, 2025

@szechyjs thanks for the PR, I went ahead and fixed a small issue with a missing cli arg and added a changelog entry.

I also found that --log-level does not work when passed via cli (it does via env var)... Something to investigate separetely.

Yea I noticed the same, I originally implemented the cli arg and it didn't work, so removed it. Glad it's an existing issue.

@Dav1dde
Copy link
Member

Dav1dde commented Feb 3, 2025

Yea I noticed the same, I originally implemented the cli arg and it didn't work, so removed it.

Because of this change:

log_format: matches.get_one("log_format").cloned(),
it must be still exposed via CLI.

I suspect it's just an order problem, we initialize logging before applying CLI ovverides.

@Dav1dde Dav1dde merged commit bdfeaf1 into getsentry:master Feb 4, 2025
25 checks passed
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.

3 participants