-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
@vy is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@bitsandfoxes could you take a look at this when you have a moment? |
There was a problem hiding this 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.
@ppkarwasz, Thanks so much for the review.
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:
Log4j team can ping Sentry again when this plan is realized. |
I think this is a problem that |
@bitsandfoxes Hi! Could you take a look at this PR when you have a moment? |
@adinauer this looks like it's somewhere in your area of the world. |
<Loggers> | ||
<Root level="INFO"> | ||
<AppenderRef ref="CONSOLE"/> | ||
<AppenderRef ref="SENTRY" level="ERROR"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for adding the level
here, compared to the original?
Do you want to highlight the possibility of overriding the level like in docs/platforms/java/common/legacy/log4j2/index.mdx
? If so, I would suggest to also add a comment here, like in the mentioned file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lbloder, earlier the snippet was as follows:
<Root level="info">
<AppenderRef ref="Sentry"/>
<AppenderRef ref="Console"/>
</Root>
Though this didn't capture the configuration stated at the beginning of the java.log4j2.mdx
file:
The following example using the
log4j2.xml
format to configure aConsoleAppender
that logs to standard out at theINFO
level, and aSentryAppender
that logs to the Sentry server at theERROR
level.
That is, sending ERROR
s (and of higher severity) to Sentry was misconfigured – I fixed it.
Do you want to highlight the possibility of overriding the level like in
docs/platforms/java/common/legacy/log4j2/index.mdx
...
I am not able to follow you. I fixed legacy/log4j2/index.mdx
too, since that document was stating:
The following example configures a
ConsoleAppender
that logs to standard out at theINFO
level and aSentryAppender
that logs to the Sentry server at theWARN
level.
Hence, AFAIC, all configurations now match what is stated to be expected from them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vy Sorry for the confusion.
Thank you, for fixing this, I just looked at the differences in the xml and thus overlooked the fact that the description was wrong in the first place.
I am not able to follow you. I fixed legacy/log4j2/index.mdx too, since that document was stating
I was referring to the inline comment above theAppenderRef
that might be helpful for users copying the xml.
For example:
<Root level="info">
<AppenderRef ref="CONSOLE"/>
<!-- Note that the Sentry logging threshold is overridden to the ERROR level -->
<AppenderRef ref="SENTRY" level="ERROR"/>
</Root>
@vy @ppkarwasz I had a quick sync internally, and for now, we would like to keep the schema out of the examples due to the xml not being valid against the schema. We will look into @ppkarwasz suggestion on creating our own schema that includes the Also, whenever your long-term plan is realized, please let us know. |
@lbloder, how do you plan to proceed with this PR? |
@vy Then I think we can move foward and approve. Thanks again for doing this 👍 |
Co-authored-by: Piotr P. Karwasz <[email protected]>
Co-authored-by: Piotr P. Karwasz <[email protected]>
Co-authored-by: Piotr P. Karwasz <[email protected]>
Done. |
@adinauer would you take a look when you have a moment please? |
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to IntelliJ still complaining, we're removing the xmlns
.
@vy Thank your for bearing with us. We already pushed this change and approved the PR. |
@lbloder, @bitsandfoxes still appears as the last pending reviewer. Is there anything else I can do to get this PR merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @vy, forgot to approve
@lbloder, thanks for the prompt reaction. Yet AFAICS, your approval is not sufficient: |
Sorry for the delays and hickups, trying to figure out what's going on with CI so we can get this PR merged. |
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 PRpackages
attributestatus
attributeLog4j2
in text withLog4j 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: