Skip to content

Default Rails logger does not output to STDOUT in development env #238

@morgoth

Description

@morgoth

When generating new Rails app (tested with main branch) the deafult Rails logger in development env looks like this:

dupa(dev)> Rails.logger
=> 
#<ActiveSupport::BroadcastLogger:0x00007cad6f8fa608
 @broadcasts=
  [#<ActiveSupport::Logger:0x00007cad6f90da78
    @default_formatter=#<Logger::Formatter:0x00007cad6f8fc9a8 @datetime_format=nil>,
    @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007cad6f8fa9c8 @datetime_format=nil>,
    @level=0,
    @level_override={},
    @local_level_key=:logger_thread_safe_level_14520,
    @logdev=
     #<Logger::LogDevice:0x00007cad6f90e748
      @binmode=false,
      @dev=#<File:/home/wojtek/Projects/dupa/log/development.log>,
      @filename="/home/wojtek/Projects/dupa/log/development.log",
      @mon_data=#<Monitor:0x00007cad6f8fc8b8>,
      @mon_data_owner_object_id=4560,
      @shift_age=1,
      @shift_period_suffix="%Y%m%d",
      @shift_size=104857600>,
    @progname=nil>,
   #<ActiveSupport::Logger:0x00007cad6f8506a8
    @default_formatter=#<Logger::Formatter:0x00007cad6f1e4800 @datetime_format=nil>,
    @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007cad6f1e4698 @datetime_format=nil>,
    @level=0,
    @level_override={},
    @logdev=
     #<Logger::LogDevice:0x00007cad6f850658
      @binmode=false,
      @dev=#<IO:<STDERR>>,
      @filename=nil,
      @mon_data=#<Monitor:0x00007cad6f1e4760>,
      @mon_data_owner_object_id=14500,
      @shift_age=nil,
      @shift_period_suffix=nil,
      @shift_size=nil>,
    @progname=nil>],
 @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007cad6f8fa9c8 @datetime_format=nil>,
 @progname="Broadcast">

When running SQ via bundle exec rake solid_queue:start there is nothing printed on the terminal.
SQ logs are only put into the log/development.log file.

I can workaround the issue by specifying logger by hand in environments/development.rb:
config.logger = ActiveSupport::Logger.new(STDOUT)

Not sure if this is some issue with Rails or Rails defaults or SQ, but running SQ on fresh new Rails app might be confusing due to no terminal log-feedback when launched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions