Skip to content

Fixes #39290 - Add :registration named logger with session markers#10975

Open
pablomh wants to merge 1 commit intotheforeman:developfrom
pablomh:registration/add-registration-logger
Open

Fixes #39290 - Add :registration named logger with session markers#10975
pablomh wants to merge 1 commit intotheforeman:developfrom
pablomh:registration/add-registration-logger

Conversation

@pablomh
Copy link
Copy Markdown
Contributor

@pablomh pablomh commented May 5, 2026

Summary

Adds a dedicated :registration named logger for host registration events, independently configurable from the main Rails logger.

Changes

  • config/application.rb: Register :registration as a named logger
  • registration_controller.rb: Emit session_start on GET /register and session_complete on POST /register with host name, action (created/updated), and wall-clock duration
  • Test: Verify log lines are emitted with correct content

Log output

# GET /register (script delivery)
[registration] session_start org=Default loc=Default hostgroup=RHEL9

# POST /register (host record creation)
[registration] session_complete host=server.example.com action=created duration_ms=234

Why a dedicated logger

The :registration named logger lets operators enable debug level for registration events without flooding the log with SQL queries or view rendering:

:logging:
  :loggers:
    :registration:
      :level: debug

At debug level, companion Katello PRs emit Candlepin per-call timing and cache HIT/MISS decisions using the same logger.

How to test

  1. bundle exec rake test TEST=test/controllers/api/v2/registration_controller_test.rb
  2. Register a host and check production.log for session_start and session_complete lines

Add a dedicated :registration named logger for host registration
events, independently configurable from the main Rails logger.

At the default info level, emits session_start (GET /register) and
session_complete (POST /register) with host name, action
(created/updated), and wall-clock duration. At debug level,
companion Katello PRs emit Candlepin per-call timing and cache
HIT/MISS decisions using the same logger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant