Skip to content

Template the requestAttributesEnabled parameter for the AccessLogValve#27655

Open
DilshanSenarath wants to merge 2 commits intowso2:archive_IS-7.3from
DilshanSenarath:access-log-valce-fix
Open

Template the requestAttributesEnabled parameter for the AccessLogValve#27655
DilshanSenarath wants to merge 2 commits intowso2:archive_IS-7.3from
DilshanSenarath:access-log-valce-fix

Conversation

@DilshanSenarath
Copy link
Copy Markdown
Contributor

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2af9d347-3c76-4b94-bb3b-dd4ab8202ee1

📥 Commits

Reviewing files that changed from the base of the PR and between 270be3b and ad24cc7.

📒 Files selected for processing (1)
  • modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2

📝 Walkthrough

Summary

This pull request templates the requestAttributesEnabled parameter for the Tomcat AccessLogValve, making it configurable via the repository configuration rather than hardcoded.

Changes

  • modules/distribution/src/repository/resources/conf/default.json

    • Added http_access_log.request_attributes_enabled with a default value of false.
  • modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2

    • Updated the AccessLogValve template to include the requestAttributesEnabled attribute, sourced from http_access_log.request_attributes_enabled. Adjusted the valve tag formatting to accommodate the new attribute.

Impact

Operators can now control whether request attributes are included in HTTP access logs by changing the configuration value, without modifying template files.

Walkthrough

A new configuration property http_access_log.request_attributes_enabled is introduced in the default configuration file and set to false. The Tomcat AccessLogValve template is updated to read this property and set the corresponding requestAttributesEnabled attribute on the valve element. This change disables HTTP access logging of request attributes by default. The valve configuration structure is reformatted from a single-line self-closing tag to a multi-line format to accommodate the new attribute.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: templating the requestAttributesEnabled parameter for the AccessLogValve component.
Description check ✅ Passed The description is related to the changeset, identifying the purpose (templating the requestAttributesEnabled parameter) and referencing the associated issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2 (1)

137-140: Boolean value will render as Python-style True/False.

Jinja2 renders Python booleans with capitalized first letter, so {{http_access_log.request_attributes_enabled}} will emit False (or True) rather than the XML-idiomatic lowercase false/true. While Boolean.parseBoolean in Tomcat is case-insensitive and will still resolve correctly, the rendered XML is inconsistent with standard conventions and other boolean attributes. Consider normalizing to lowercase.

Proposed fix
-                        requestAttributesEnabled="{{http_access_log.request_attributes_enabled}}"
+                        requestAttributesEnabled="{{ http_access_log.request_attributes_enabled | string | lower }}"
Jinja2 rendering of Python boolean False in template output
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2`
around lines 137 - 140, The template emits Python-style booleans for the Valve
attribute; update the catalina-server.xml.j2 Valve attribute for
http_access_log.request_attributes_enabled so it is rendered in lowercase
(standard "true"/"false") by applying Jinja2's lowercase filter/normalization to
the variable (http_access_log.request_attributes_enabled) so the rendered XML
uses lowercase boolean values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2`:
- Around line 137-140: The template emits Python-style booleans for the Valve
attribute; update the catalina-server.xml.j2 Valve attribute for
http_access_log.request_attributes_enabled so it is rendered in lowercase
(standard "true"/"false") by applying Jinja2's lowercase filter/normalization to
the variable (http_access_log.request_attributes_enabled) so the rendered XML
uses lowercase boolean values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52f858ca-c021-43c2-8a5e-827a5ae88a57

📥 Commits

Reviewing files that changed from the base of the PR and between 6333682 and 270be3b.

📒 Files selected for processing (2)
  • modules/distribution/src/repository/resources/conf/default.json
  • modules/distribution/src/repository/resources/conf/templates/repository/conf/tomcat/catalina-server.xml.j2

@DilshanSenarath DilshanSenarath changed the base branch from archive_IS-7.3 to master April 30, 2026 06:29
@DilshanSenarath DilshanSenarath changed the base branch from master to archive_IS-7.3 April 30, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant