Warnings in app boot · Issue #122 · reidmorrison/rails_semantic_logger · GitHub Skip to content Sign up Why GitHub? Features → Mobile → Actions → Codespaces → Packages → Security → Code review → Issues → Integrations → GitHub Sponsors → Customer stories→ Team Enterprise Explore Explore GitHub → Learn and contribute Topics → Collections → Trending → Learning Lab → Open source guides → Connect with others The ReadME Project → Events → Community forum → GitHub Education → GitHub Stars program → Marketplace Pricing Plans → Compare plans → Contact Sales → Education → In this repository All GitHub ↵ Jump to ↵ No suggested jump to results In this repository All GitHub ↵ Jump to ↵ In this user All GitHub ↵ Jump to ↵ In this repository All GitHub ↵ Jump to ↵ Sign in Sign up {{ message }} reidmorrison / rails_semantic_logger Notifications Star 175 Fork 65 Code Issues 3 Pull requests 2 Actions Projects 0 Wiki Security Insights More Code Issues Pull requests Actions Projects Wiki Security Insights 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. Pick a username Email Address Password Sign up for GitHub 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 Jump to bottom Warnings in app boot #122 Closed kadru opened this issue Feb 15, 2021 · 2 comments Closed Warnings in app boot #122 kadru opened this issue Feb 15, 2021 · 2 comments Labels awaiting feedback Comments Copy link kadru commented Feb 15, 2021 Environment Ruby 2.5.7 Rails 6.0.3.4 Semantic Logger 4.7.4 Rails Semantic Logger 4.5.0 Puma 5.1.1 config/application.rb STDOUT.sync = true config.rails_semantic_logger.processing = false config.rails_semantic_logger.add_file_appender = false config.rails_semantic_logger.format = :json config.semantic_logger.add_appender( io: STDOUT, level: config.log_level, formatter: config.rails_semantic_logger.format) config/puma.rb on_worker_boot do # Re-open appenders after forking the process SemanticLogger.reopen end Expected Behavior No warnings when is in use with rails and puma. Actual Behavior Warnings: 2021-02-15T02:37:25.152238+00:00 app[web.1]: [4] * Listening on http://0.0.0.0:14255 2021-02-15T02:37:25.152293+00:00 app[web.1]: [4] ! WARNING: Detected 2 Thread(s) started in app boot: 2021-02-15T02:37:25.152294+00:00 app[web.1]: [4] ! # - /app/vendor/bundle/ruby/2.5.0/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async.rb:150:in `pop' 2021-02-15T02:37:25.152352+00:00 app[web.1]: [4] ! # - /app/vendor/bundle/ruby/2.5.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:337:in `sleep' The text was updated successfully, but these errors were encountered: 👍 2 We are unable to convert the task to an issue at this time. Please try again. The issue was successfully created but we are unable to update the comment at this time. Copy link Owner reidmorrison commented May 3, 2021 We run Puma in single mode, so you are on your own with this one. The Semantic Logger thread being created is by design, without it no logging will be performed. Suggest looking into what is generating that warning log message, since it is not from Semantic Logger. Copy link Owner reidmorrison commented Jun 16, 2021 I booted our application in clustered mode without any issues. Below is the log output: % bin/rails s => Booting Rails => Booting Puma => Rails 6.1.3.2 application starting in development => Run `bin/rails server --help` for more startup options ... [12175] Puma starting in cluster mode... [12175] * Puma version: 5.3.2 (ruby 3.0.1-p64) ("Sweetnighter") [12175] * Min threads: 5 [12175] * Max threads: 5 [12175] * Environment: development [12175] * Master PID: 12175 [12175] * Workers: 2 [12175] * Restarts: (✔) hot (✔) phased [12175] * Listening on http://127.0.0.1:3003 [12175] * Listening on http://[::1]:3003 [12175] Use Ctrl-C to stop [12175] - Worker 0 (PID: 12186) booted in 0.01s, phase: 0 [12175] - Worker 1 (PID: 12187) booted in 0.01s, phase: 0 2021-06-16 20:22:04.182425 D [12186:puma threadpool 002 logger.rb:41] Rack -- Started -- { method: "GET", path: "/", ip: "127.0.0.1" } ... As per the docs, just had to add SemanticLogger.reopen to the on_worker_boot to get logging working. These are the lines I added / uncommented in config/puma.yml workers ENV.fetch("WEB_CONCURRENCY") { 2 } before_fork do ApplicationRecord.connection_pool.disconnect! if defined?(ActiveRecord) end on_worker_boot do ApplicationRecord.establish_connection if defined?(ActiveRecord) # Re-open appenders after forking the process SemanticLogger.reopen end reidmorrison added the awaiting feedback label Jun 16, 2021 reidmorrison closed this Jun 30, 2021 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Assignees No one assigned Labels awaiting feedback Projects None yet Milestone No milestone Linked pull requests Successfully merging a pull request may close this issue. None yet 2 participants © 2021 GitHub, Inc. Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About You can’t perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.