Skip to content

Adds examples for Log4j 2's JSON format log template layout #29985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joon-shin-ddhq
Copy link
Contributor

@joon-shin-ddhq joon-shin-ddhq commented Jun 17, 2025

What does this PR do? What is the motivation?

The Java Log Collection docs are missing an example of a JSON layout template for the Log4j 2 appender. This template is necessary for Java apps to emit logs in JSON format, but the docs don't provide one. As someone who doesn't work with Java regularly, it took me quite a while to track down a working example. Judging from this Slack thread, I wasn’t the only one who ran into this.

https://dd.slack.com/archives/C4W013KEU/p1749835158457139

I have added the following to this doc page:

  • Adds a full example for Log4j 2's JSON format log template layout file, MyLayout.json
  • Adds an instruction to remove dd.trace_id and dd_span.id from the template layout examples, if the log and trace correlation is not used.

Please have a Java Log Collection PM or an APM Injection Platform PM review these changes.

Merge instructions

Merge readiness:

  • [] Ready for merge

For Datadog employees:

Your branch name MUST follow the <name>/<description> convention and include the forward slash (/). Without this format, your pull request will not pass CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.

If your branch doesn't follow this format, rename it or create a new branch and PR.

[6/5/2025] Merge queue has been disabled on the documentation repo. If you have write access to the repo, the PR has been reviewed by a Documentation team member, and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #documentation channel in Slack.

Additional notes

- Adds a full example for Log4j 2's JSON format log template layout file, MyLayout.json
- Adds an instruction to remove dd.trace_id and dd_span.id from the template layout examples, if the log and trace correlation is not used.
@joon-shin-ddhq joon-shin-ddhq requested a review from a team as a code owner June 17, 2025 15:30
Copy link
Contributor

📝 Documentation Team Review Required

This pull request requires approval from the @DataDog/documentation team before it can be merged.

Please ensure your changes follow our documentation guidelines and wait for a team member to review and approve your changes.

Copy link
Contributor

Preview links (active after the build_preview check completes)

Modified Files

@joon-shin-ddhq
Copy link
Contributor Author

@ptabasso2 FYI, I submitted a PR to add the JSON layout template to our official documentation. Thanks for your help!

@maycmlee maycmlee added editorial review Waiting on a more in-depth review under_review Sent to someone outside of the docs team for review. labels Jun 17, 2025
@maycmlee
Copy link
Contributor

Created DOCS-11251 for docs review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial review Waiting on a more in-depth review under_review Sent to someone outside of the docs team for review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants