Project

General

Profile

Bug #14820

Log level from settings.yaml not applied to app logger

Added by Dominic Cleal almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Logging
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

In Foreman 1.11 and higher, the log level configured in config/settings.yaml isn't applied to the app logger, so production users only get info+ messages.

On 1.10-stable:

2016-04-26T15:28:08 [app] [I] Started GET "/users/login" for 127.0.0.1 at 2016-04-26 15:28:08 +0100
2016-04-26T15:28:08 [app] [I] Processing by UsersController#login as HTML
2016-04-26T15:28:08 [app] [D] Setting current user thread-local variable to nil
2016-04-26T15:28:08 [app] [I]   Rendered users/login.html.erb within layouts/login (9.4ms)
2016-04-26T15:28:08 [app] [I]   Rendered layouts/base.html.erb (15.2ms)

On 1.11-stable:

2016-04-26T15:30:39 [app] [I] Started GET "/users/login" for 127.0.0.1 at 2016-04-26 15:30:39 +0100
2016-04-26T15:30:39 [app] [I] Processing by UsersController#login as HTML
2016-04-26T15:30:39 [sql] [D]   ActiveRecord::SessionStore::Session Load (0.1ms)  SELECT  "sessions".* FROM "sessions"  WHERE "sessions"."session_id" = 'ae80f506141e1f10e0c7bbcee6b62566'  ORDER BY "sessions"."id" ASC LIMIT 1
2016-04-26T15:30:39 [sql] [D]   Setting Load (0.1ms)  SELECT  "settings".* FROM "settings"  WHERE "settings"."name" = 'authorize_login_delegation'  ORDER BY "settings"."name" ASC LIMIT 1
2016-04-26T15:30:39 [app] [I]   Rendered users/login.html.erb within layouts/login (2.0ms)
2016-04-26T15:30:39 [app] [I]   Rendered layouts/base.html.erb (2.8ms)
2016-04-26T15:30:39 [sql] [D]   Setting Load (0.2ms)  SELECT  "settings".* FROM "settings"  WHERE "settings"."name" = 'idle_timeout'  ORDER BY "settings"."name" ASC LIMIT 1
2016-04-26T15:30:39 [app] [I] Completed 200 OK in 25ms (Views: 7.8ms | ActiveRecord: 2.4ms)

However, change config.log_level in config/environments/production.rb to :debug and it does correctly print app logger debug:

2016-04-26T15:31:50 [app] [I] Started GET "/users/login" for 127.0.0.1 at 2016-04-26 15:31:50 +0100
2016-04-26T15:31:50 [app] [I] Processing by UsersController#login as HTML
2016-04-26T15:31:50 [sql] [D]   ActiveRecord::SessionStore::Session Load (0.1ms)  SELECT  "sessions".* FROM "sessions"  WHERE "sessions"."session_id" = 'ae80f506141e1f10e0c7bbcee6b62566'  ORDER BY "sessions"."id" ASC LIMIT 1
2016-04-26T15:31:50 [sql] [D]   Setting Load (0.1ms)  SELECT  "settings".* FROM "settings"  WHERE "settings"."name" = 'authorize_login_delegation'  ORDER BY "settings"."name" ASC LIMIT 1
2016-04-26T15:31:50 [app] [D] Setting current user thread-local variable to nil
2016-04-26T15:31:50 [app] [I]   Rendered users/login.html.erb within layouts/login (2.1ms)
2016-04-26T15:31:50 [app] [I]   Rendered layouts/base.html.erb (1.3ms)
2016-04-26T15:31:50 [sql] [D]   Setting Load (0.2ms)  SELECT  "settings".* FROM "settings"  WHERE "settings"."name" = 'idle_timeout'  ORDER BY "settings"."name" ASC LIMIT 1
2016-04-26T15:31:50 [app] [I] Completed 200 OK in 23ms (Views: 7.0ms | ActiveRecord: 2.2ms)

It shouldn't be necessary to do this, the Foreman logging support is meant to reconfigure the app logger.


Related issues

Related to Foreman - Refactor #12914: update rails configuration files to match to 4.1 syntaxClosed2015-12-22

Associated revisions

Revision 96d32beb (diff)
Added by Dominic Cleal almost 4 years ago

fixes #14820 - override Rails log level with Foreman::Logging config

The log_level is expected to be explicitly configured in the Rails
config in the production environment.

Revision 47518469 (diff)
Added by Dominic Cleal almost 4 years ago

fixes #14820 - override Rails log level with Foreman::Logging config

The log_level is expected to be explicitly configured in the Rails
config in the production environment.

(cherry picked from commit 96d32beb6f9b3dac8e5caf3da11731fd2c894929)

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 155

#2 Updated by Dominic Cleal almost 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

#3 Updated by Dominic Cleal almost 4 years ago

  • Related to Refactor #12914: update rails configuration files to match to 4.1 syntax added

#4 Updated by The Foreman Bot almost 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3475 added

#5 Updated by Dominic Cleal almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF