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

Fixes #26935 - added stdout logging option back #6817

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

lzap
Copy link
Member

@lzap lzap commented Jun 3, 2019

With logging refactoring, we actually dropped ability to set STDOUT logging output for Rails. This ticket adds this possibility back.

@theforeman-bot
Copy link
Member

Issues: #26935

@ohadlevy
Copy link
Member

ohadlevy commented Jun 3, 2019

I gave this a try and got the following error:

app_1     | bundler: failed to load command: bin/rails (bin/rails)
app_1     | ArgumentError: unknown appender #<Logging::RootLogger:0x00005569f39af5a8 @name="root", @appenders=[], @additive=false, @caller_tracing=false, @level=1>
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/logging-2.2.2/lib/logging/logger.rb:343:in `block in add_appenders'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/logging-2.2.2/lib/logging/logger.rb:341:in `each'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/logging-2.2.2/lib/logging/logger.rb:341:in `add_appenders'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/logging-2.2.2/lib/logging/logger.rb:331:in `appenders='
app_1     |   /home/foreman/lib/foreman/logging.rb:140:in `configure_root_logger'
app_1     |   /home/foreman/lib/foreman/logging.rb:23:in `configure'
app_1     |   /home/foreman/config/application.rb:208:in `<class:Application>'
app_1     |   /home/foreman/config/application.rb:77:in `<module:Foreman>'
app_1     |   /home/foreman/config/application.rb:76:in `<top (required)>'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:145:in `block in perform'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `tap'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in `perform'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/command/base.rb:65:in `perform'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/command.rb:46:in `invoke'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<top (required)>'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
app_1     |   /home/foreman/vendor/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
app_1     |   bin/rails:9:in `<top (required)>'

if you want to reproduce my env, just apply

diff --git a/docker-compose.yml b/docker-compose.yml
index 821984ff2..91d21808d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -20,7 +20,7 @@ services:
       - db:/var/lib/mysql/data
 
   app: &app_base
-    image: quay.io/foreman/foreman:develop
+    image: quay.io/ohadlevy/foreman:lzap-logging-stdout-26935
     command: bundle exec bin/rails server -b 0.0.0.0
     build:

@lzap
Copy link
Member Author

lzap commented Jun 3, 2019

Try now. Works locally.

@ohadlevy
Copy link
Member

ohadlevy commented Jun 3, 2019

Try now. Works locally.

thanks, while it doesnt break now, it doesnt actually anything after rails intiatlization code, e.g. I'm seeing

app_1     | => Booting Puma
app_1     | => Rails 5.2.1 application starting in production 
app_1     | => Run `rails server -h` for more startup options
app_1     | Puma starting in single mode...
app_1     | * Version 3.12.1 (ruby 2.6.2-p47), codename: Llamas in Pajamas
app_1     | * Min threads: 0, max threads: 16
app_1     | * Environment: production
app_1     | * Listening on tcp://0.0.0.0:3000
app_1     | Use Ctrl-C to stop

but nothing else afterwards (even if I have made multiple requests) - steps to reproduce are the same as in the above comment. thanks!

@lzap
Copy link
Member Author

lzap commented Jun 3, 2019

What is in your settings.yaml please? Is this the default value?

@ohadlevy
Copy link
Member

ohadlevy commented Jun 3, 2019

What is in your settings.yaml please? Is this the default value?

it seems I was wrong, sorry, this does work as expected!
and for the record, I'm running without a settings.yaml file in the container (just the defaults).

@ohadlevy ohadlevy merged commit 5462f36 into theforeman:develop Jun 3, 2019
@lzap lzap deleted the logging-stdout-26935 branch June 3, 2019 14:40
@lzap
Copy link
Member Author

lzap commented Jun 3, 2019

Pfeeeeew that was close, you almost made me to start a container! 😌

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