Skip to content

HIVE-28184: Fix HiveServer2 WebUI "Configure logging" page - #6732

Open
ashniku wants to merge 2 commits into
apache:masterfrom
ashniku:HIVE-28184
Open

HIVE-28184: Fix HiveServer2 WebUI "Configure logging" page#6732
ashniku wants to merge 2 commits into
apache:masterfrom
ashniku:HIVE-28184

Conversation

@ashniku

@ashniku ashniku commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  1. logconf.jsp — always renders the "Set new logging rules" form (previously it was hidden unless a JDBC session existed and was rendered once per session). Replaces the free-text logger field with a dropdown and aligns the form controls.
  2. logconf.js — populates the logger dropdown from /conflog, auto-selects the selected logger's current level, shows the root logger as (root), POSTs updates as application/json, treats the empty 200 response as success (fixing a false "failed" error), and builds the table with text() to prevent HTML injection.
  3. Log4j2ConfiguratorServlet — fixes level updates so configuring a not-yet-defined child logger adds a new logger instead of silently changing one of its ancestors (getLoggerConfig returns the nearest ancestor for an unconfigured name).
  4. Tests — adds TestLog4j2ConfiguratorServlet covering new-logger creation, in-place updates, the root logger, and every level offered by the UI.

Why are the changes needed?

The page could not configure logging when there were no active sessions, could accidentally change a parent logger's level, displayed the root logger as a blank row, and showed a spurious error on every successful update. Together these made the feature effectively unusable.

Does this PR introduce any user-facing change?

Yes — WebUI only. The "Configure logging" page now shows a populated logger dropdown, correctly applies levels, labels the root logger (root), and no longer shows a false error on success. No API/CLI/config changes.

How was this patch tested?

  1. New unit test TestLog4j2ConfiguratorServlet (5 tests) — passing.
  2. Manual end-to-end on a MiniHS2 LLAP cluster: verified all 32 runtime loggers × all 6 levels (TRACE→FATAL) applied and reflected back via /conflog, and that a new child logger did not alter its parent.

- Always render the logger form instead of gating it on active sessions,
  so logging can be configured even with no open JDBC session.
- Populate a logger dropdown from /conflog and auto-select each logger's
  current level; show the root logger as "(root)".
- Fix Log4j2ConfiguratorServlet so setting a not-yet-configured child
  logger adds a new logger instead of changing an existing ancestor.
- POST level updates as application/json and treat the empty 200 response
  as success; render the table via text() to avoid HTML injection.
- Add TestLog4j2ConfiguratorServlet unit tests covering new/child/root
  loggers and every supported level.
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants