Skip to content
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

fix: Log4j configurations and wording #11395

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

Conversation

vy
Copy link

@vy vy commented Sep 19, 2024

The current Log4j 2 documentation contains configurations with deprecated and redundant packages attributes, which cause runtime warnings for users – see apache/logging-log4j2#2966. This PR

  • Removes the usage of the deprecated (and redundant) packages attribute
  • Removes the usage of the redundant status attribute
  • Adds XML namespace (to enable IDE assistance while users are editing)
  • Adapt Log4j component and XML naming conventions
  • Replaces occurrences of Log4j2 in text with Log4j 2

IS YOUR CHANGE URGENT?

Not urgent, can wait up to 1 week+

REVIEWERS

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

Copy link

vercel bot commented Sep 19, 2024

@vy is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
changelog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 5:20pm
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 5:20pm
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 5:20pm

@lizokm
Copy link
Contributor

lizokm commented Sep 19, 2024

@bitsandfoxes could you take a look at this when you have a moment?

Copy link

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

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

@vy, looks great, but I would skip the schema location in the examples. Since Sentry is not in the generated XML Schema, the examples would not validate.

Some context for the Sentry team

We recently added a log4j-docgen tool that generates documentation and XML schemas from the Javadoc of elements annotated with @Plugin*.
You can find more information on the Log4j Docgen website.

A priori the tool could generate an XML Schema, which includes the Sentry element and all its options, but it is still pretty much rough around the edges and currently we only use it for our internal artifacts.

The long term plan, however, is:

  • We ask Log4j Plugin vendors to publish a *-log4jdoc.xml artifact with each release.
  • We configure Dependabot to watch for updates to sentry-log4j2.
  • At each new release we regenerate our Plugin Reference to include Sentry,
  • At each new release we regenerate our XSD Schemas to include a Sentry element.

As I mentioned before, right now such a process would be far from being easy, but in time it could show the size of the Log4j community and make logging.apache.org more of a common effort.

Comment on lines +44 to +46
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">

Choose a reason for hiding this comment

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

Suggested change
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">
<Configuration xmlns="https://logging.apache.org/xml/ns">

Comment on lines +94 to +96
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">

Choose a reason for hiding this comment

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

Suggested change
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">
<Configuration xmlns="https://logging.apache.org/xml/ns">

Comment on lines +11 to +13
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">

Choose a reason for hiding this comment

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

Suggested change
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">
<Configuration xmlns="https://logging.apache.org/xml/ns">

@vy
Copy link
Author

vy commented Sep 19, 2024

@ppkarwasz, Thanks so much for the review.

I would skip the schema location in the examples. Since Sentry is not in the generated XML Schema, the examples would not validate.

I prefer to keep the schema location, since, contrary to the current situation (and your proposal) where there is no IDE assistance, my proposal will enable complete IDE assistance except for one line: <Sentry .../>. As can be seen from the user report in apache/logging-log4j2#2966, a typical Sentry user's log4j2.xml contains dozens of lines of code that can take advantage of the XML schema. All in all, I leave it at the discretion of the Sentry team whether to keep the XML schema location or not.

The long term plan, however, is:

Log4j team can ping Sentry again when this plan is realized.

@ppkarwasz
Copy link

I prefer to keep the schema location, since, contrary to the current situation (and your proposal) where there is no IDE assistance, my proposal will enable complete IDE assistance except for one line: <Sentry .../>. As can be seen from the user report in apache/logging-log4j2#2966, a typical Sentry user's log4j2.xml contains dozens of lines of code that can take advantage of the XML schema. All in all, I leave it at the discretion of the Sentry team whether to keep the XML schema location or not.

I think this is a problem that <xsd:include> could fix. A small XML schema could include the one at logging.apache.org add a Sentry type and override the org.apache.logging.log4j.core.Appender element group.

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