Skip to content

Template the requestAttributesEnabled parameter for the AccessLogValve - #27655

Merged
DilshanSenarath merged 2 commits into
wso2:masterfrom
DilshanSenarath:access-log-valce-fix
Jun 2, 2026
Merged

Template the requestAttributesEnabled parameter for the AccessLogValve#27655
DilshanSenarath merged 2 commits into
wso2:masterfrom
DilshanSenarath:access-log-valce-fix

Conversation

@DilshanSenarath

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 85e758bf-df98-49eb-884e-474aa31e6bb0

📥 Commits

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

📒 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
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/distribution/src/repository/resources/conf/default.json

📝 Walkthrough

Summary

This pull request templates the requestAttributesEnabled parameter for the Tomcat AccessLogValve, making it configurable via repository configuration instead of being 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; when http_access_log.useLogger is true the configurable logger remains a compact tag, otherwise the standard AccessLogValve now includes the templated attribute.

Impact

Operators can now control whether request attributes are included in HTTP access logs by changing the http_access_log.request_attributes_enabled 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. 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 directly and specifically describes the main change: templating the requestAttributesEnabled parameter for the AccessLogValve.
Description check ✅ Passed The description relates to the changeset by identifying the purpose and linking to the related issue, though it lacks implementation details.
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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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
@DilshanSenarath
DilshanSenarath changed the base branch from archive_IS-7.3 to master June 2, 2026 08:58
@DilshanSenarath
DilshanSenarath changed the base branch from master to archive_IS-7.3 June 2, 2026 08:59
@DilshanSenarath
DilshanSenarath changed the base branch from archive_IS-7.3 to master June 2, 2026 09:02
@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/26809743574

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/26809743574
Status: success

@jenkins-is-staging jenkins-is-staging left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/26809743574

@DilshanSenarath
DilshanSenarath merged commit b951992 into wso2:master Jun 2, 2026
2 checks passed
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.

3 participants