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

Logs are colorized regardless of colorized_logging do to load order requirements of dotenv #514

Open
davetron5000 opened this issue Nov 18, 2024 · 0 comments

Comments

@davetron5000
Copy link

Steps to reproduce

  1. Make as new Rails app
  2. add config.colorize_logging = false to config/environments/development.rb
  3. Set up some .env files
  4. Start Rails
  5. Look at the log

Expected behavior

Log messages issued by this gem should respect the colorize_logging value in general, or in this case, not colorize its log output.

Actual behavior

dotenv's initial log messasges are colorized because dotenv loads itself and the .env files before the Rails configuration has taken place to turn off colorized logging.

[dotenv] Set ^[[36mDATABASE_URL^[[0m
[dotenv] Loaded ^[[33m.env.development^[[0m

System configuration

dotenv version: 3.1.4

Rails version: 8.0.0

Ruby version: 3.3.6

Notes

I don't see a way to tell Rails to avoid colorized logging any earlier.

I can think of two solutions:

  • Change these log messages to debug - they don't seem necessary to be at info level
  • Change the logging calls to avoid color altogether

Maybe there is a better third option I'm not thinking of?

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

No branches or pull requests

1 participant