padrino/padrino-framework · warning

No logging configuration for :#{config_level} found, falling

Error message

No logging configuration for :#{config_level} found, falling back to :production

What it means

Logger.setup! picks the logger configuration from Padrino::Logger::Config using PADRINO_LOG_LEVEL or Padrino.env. Only :production, :development and :test exist by default, plus any keys merged from the PADRINO_LOGGER constant. When the resolved level has no Config entry, Padrino warns and silently falls back to the production configuration (log level :warn, stream :to_file).

Source

Thrown at padrino-core/lib/padrino-core/logger.rb:356

                    To do it with a custom logger you have to manually `new_logger.extend(Padrino::Logger::Extensions)`
                    before passing to `Padrino.logger = new_logger`.
        MESSAGE
      end
      @_logger = logger
    end

    ##
    # Setup a new logger.
    #
    # @return [Padrino::Logger]
    #   A {Padrino::Logger} instance
    #
    def self.setup!
      config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
      config = Config[config_level]

      unless config
        warn("No logging configuration for :#{config_level} found, falling back to :production")
        config = Config[:production]
      end

      stream =
        case config[:stream]
        when :to_file
          if (filename = config[:log_path])
            filename = Padrino.root(filename) unless Pathname.new(filename).absolute?
            if File.directory?(filename)
              filename = File.join(filename, "#{Padrino.env}.log")
            else
              FileUtils.mkdir_p(File.dirname(filename))
            end
            File.new(filename, 'a+')
          else
            FileUtils.mkdir_p(Padrino.root('log')) unless File.exist?(Padrino.root('log'))
            File.new(Padrino.root('log', "#{Padrino.env}.log"), 'a+')
          end

View on GitHub (pinned to 167044f3d5)

Solutions

  1. Define the environment's profile before the framework loads — in config/boot.rb: PADRINO_LOGGER = { staging: { log_level: :debug, stream: :stdout } } (these keys are merged into Config)
  2. Or add the key directly before any logging happens: Padrino::Logger::Config[:staging] = { log_level: :info, stream: :to_file, log_path: 'log' }
  3. Or force a known profile by setting PADRINO_LOG_LEVEL to production, development or test

Example fix

# before — PADRINO_ENV=staging warns and falls back to :production (warn level, file logging)

# after — config/boot.rb, before apps load:
PADRINO_LOGGER = { staging: { log_level: :debug, stream: :stdout } }
Defensive patterns

Strategy: validation

Validate before calling

# in boot.rb, before Padrino loads
level = (ENV['PADRINO_LOG_LEVEL'] || ENV['PADRINO_ENV'] || 'test').to_sym
PADRINO_LOGGER = { level => { log_level: :debug, stream: :stdout } } unless %i[production development test].include?(level)

Type guard

def known_padrino_log_env?(name)
  Padrino::Logger::Config.key?(name.to_sym)
end

Prevention

When it happens

Trigger: Running with PADRINO_ENV=staging or any custom environment (:qa, :demo) without a matching PADRINO_LOGGER entry; setting PADRINO_LOG_LEVEL to a word that is not a Config key such as verbose or info (it selects a config profile, not a severity).

Common situations: CI/CD pipelines deploying to staging-style environments; teams surprised that staging logs to a file at warn level because of the silent fallback; custom RACK_ENV/PADRINO_ENV naming schemes that drift from the three defaults.

Related errors


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/3561a1d0b7de8851. Report an issue: GitHub.