Bug 1623090

Summary: Setting --foreman-logging-level via installer doesn't affect the log level of /var/log/foreman/production.log
Product: Red Hat Satellite Reporter: Ivan Necas <inecas>
Component: InstallationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: ehelms, inecas, lzap, pmoravec, sjagtap, swadeley
Target Milestone: UnspecifiedKeywords: Regression, Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-20 07:55:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1122832, 1619394    

Description Ivan Necas 2018-08-28 13:00:24 UTC
Description of problem:

Setting --foreman-logging-level via installer doesn't affect the log level of /var/log/foreman/production.log

The installer produced the following config and it doesn't affect the final log level
------
:logging:
  :level: debug
  :production:
    :type: file
    :layout: pattern
------

This is the format that actually works:
------
:logging:
  :production:
    :type: file
    :layout: pattern
    :level: debug
------

Version-Release number of selected component (if applicable):
Sat 6.4

Comment 1 Ivan Necas 2018-08-28 13:27:04 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=1619594#c13 for more details.

Comment 6 Stephen Wadeley 2019-08-15 10:50:07 UTC
Hello

checking on Sat6.6

default:

  logging_level: info
  logging_type: file
  logging_layout: pattern
  loggers: {}


after running 
[root@sat-6-6-qa-rhel7 ~]# satellite-installer --foreman-logging-level debug

  logging_level: debug
  logging_type: file
  logging_layout: pattern
  loggers: {}


Seems the layout has changed, as a result of a fix I presume. I can check in 6.5 too.

We have this bug for 6.4


Bug 1698943 - Logging level change does not take any effect (6.4 only)

I see lzap says[1] there: "this is fixed in 6.5."

So I think we could close this as a duplicate of that bug. No harm to test on 6.5 quick.


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1698943#c3

Comment 7 Stephen Wadeley 2019-08-15 11:17:32 UTC
Hello

Works in 6.5


Before:
[root@sat-6-5-qa-rhel7 ~]# grep -C4 logging /etc/foreman-installer/scenarios.d/satellite-answers.yaml
  ipa_manage_sssd: true
  websockets_encrypt: true
  websockets_ssl_key: /etc/pki/katello/private/katello-apache.key
  websockets_ssl_cert: /etc/pki/katello/certs/katello-apache.crt
  logging_level: info
  logging_type: file
  logging_layout: pattern
  loggers: {}


[root@sat-6-5-qa-rhel7 ~]# satellite-installer --foreman-logging-level debug


After:

[root@sat-6-5-qa-rhel7 ~]# grep -C4 logging /etc/foreman-installer/scenarios.d/satellite-answers.yaml
  ipa_manage_sssd: true
  websockets_encrypt: true
  websockets_ssl_key: /etc/pki/katello/private/katello-apache.key
  websockets_ssl_cert: /etc/pki/katello/certs/katello-apache.crt
  logging_level: debug
  logging_type: file
  logging_layout: pattern
  loggers: {}


As comment 0 specifically mentions 6.4 we could close this as duplicate of:

Bug 1698943 - Logging level change does not take any effect (6.4 only)

Although that bug is newer its had more activity.

But component is different, so lets ask lzap how to proceed.


Thank you

Comment 8 Stephen Wadeley 2019-08-16 09:46:32 UTC
(In reply to Stephen Wadeley from comment #6)
> Hello
> 
> checking on Sat6.6
<snip>
> 
> 
> Seems the layout has changed, as a result of a fix I presume. I can check in
> 6.5 too.
> 
Sorry, I was looking at the answer file extract, 
this is what I should have posted:

From 6.6 latest snap

This is extract of /etc/foreman/settings.yaml with default setting:

# Log settings for the current environment can be adjusted by adding them
# here. For example, if you want to increase the log level.
:logging:
  :level: info
  :production:
    :type: file
    :layout: pattern



Now after running:
 ~]# satellite-installer --foreman-logging-level debug


 ~]# grep -r -A7 "Log settings" /etc/foreman/settings.yaml
# Log settings for the current environment can be adjusted by adding them
# here. For example, if you want to increase the log level.
:logging:
  :level: debug
  :production:
    :type: file
    :layout: pattern



This is extract from logs after running hammer host list on Sat6.6

I for Info, D for Debug. app is 2Main application logger"

2019-08-16T11:40:15 [I|app|f00c1f3f] Started GET "/api/hosts?page=1&per_page=1000" for 10.37.192.23 at 2019-08-16 11:40:15 +0200
2019-08-16T11:40:15 [I|app|f00c1f3f] Processing by Api::V2::HostsController#index as JSON
2019-08-16T11:40:15 [I|app|f00c1f3f]   Parameters: {"page"=>"1", "per_page"=>"1000", "apiv"=>"v2", "host"=>{}}
2019-08-16T11:40:15 [D|app|f00c1f3f] Authenticated user admin against INTERNAL authentication source
2019-08-16T11:40:15 [D|app|f00c1f3f] Current user set to foreman_admin (admin)
2019-08-16T11:40:15 [I|app|f00c1f3f] Authorized user admin(Admin User)
2019-08-16T11:40:15 [I|app|f00c1f3f] Current user set to admin (admin)
2019-08-16T11:40:15 [D|app|f00c1f3f] Current location set to none
2019-08-16T11:40:15 [D|app|f00c1f3f] Current organization set to none
2019-08-16T11:40:15 [D|app|f00c1f3f] Current location set to none
2019-08-16T11:40:15 [D|app|f00c1f3f] Current organization set to none
2019-08-16T11:40:15 [I|app|f00c1f3f]   Rendering api/v2/hosts/index.json.rabl within api/v2/layouts/index_layout
2019-08-16T11:40:15 [I|app|f00c1f3f]   Rendered api/v2/hosts/index.json.rabl within api/v2/layouts/index_layout (50.0ms)
2019-08-16T11:40:15 [D|app|f00c1f3f] Body: {
  "total": 4,
  "subtotal": 4,
  "page": 1,
  "per_page": 1000,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },

so it works on 6.6, I need to test 6.5 again

Comment 9 Stephen Wadeley 2019-08-16 10:57:02 UTC
further to comment 8

I confirm this works on Sat6.5, I see the same output in /var/log/foreman/production.log after enabling debug using the installer script.

thank you

Comment 10 Lukas Zapletal 2019-08-16 11:07:38 UTC
So I guess I don't need to comment then :-) Cheers.

Comment 11 Stephen Wadeley 2019-08-20 07:55:19 UTC

*** This bug has been marked as a duplicate of bug 1698943 ***