-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add a Jakarta JMS Appender #2295 #3247
Add a Jakarta JMS Appender #2295 #3247
Conversation
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.
I think we should rather proceed as in the Jakarta Mail API case:
- We create a new
log4j-jakarta-jms
artifact. - We modify
JmsAppender
to look forJmsManager
implementations viaServiceLoader
.
@Plugin(name = "JMS-Jakarta", category = Node.CATEGORY, elementType = Appender.ELEMENT_TYPE, printObject = true) | ||
public class JmsAppender extends AbstractAppender { |
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.
I would prefer to have a single JMS
plugin like we have for SMTP
:
- We can have a single
JmsAppender
and multipleJmsManager
s, - The
JmsAppender.Builder.build()
method finds an implementation ofJmsManagerFactory
usingServiceLoader
. - If it finds nothing, the default Javax implementation is used.
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.
I really don't want to do some service loader magic and finding this or that on the class path. I want to use the old or the new explicitly.
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsManager.java
Outdated
Show resolved
Hide resolved
52353a8
to
c31ff81
Compare
dafbf63
to
504625a
Compare
Hi @ppkarwasz and all: Ready for review. |
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.
Honestly I would prefer for the Jakarta JMS appender to work with the "JMS" name: as far as I understand now users need to change JMS
to JMS-Jakarta
in their Log4j Core 2 and to change from JMS-Jakarta
back to JMS
once they migrate to Log4j Core 3?
Another question that we might want to discuss is the reliance on JNDI: the JmsManager
actually only needs a JMS ConnectionFactory
and it really doesn't matter how this factory is obtained. To configure JMS we could proceed the same way as with JDBC:
- The
JMS-Jakarta
plugin could have a nestedConnectionFactoryProvider
element to specify how to obtain theConnectionFactory
. - We provide an implementation of the
ConnectionFactoryProvider
implementation that uses JNDI. - Third parties (e.g. ActiveMQ Artemis) could provide other
ConnectionFactoryProvider
. I know that Spring Boot doesn't use JNDI at all with Artemis (seeArtemisConnectionFactoryConfiguration
).
What do you think? Of course if there are configuration differences between the Javax and Jakarta JMS appenders, the name change is justified.
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/JmsAppender.java
Show resolved
Hide resolved
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/JmsManager.java
Show resolved
Hide resolved
...akarta-jms/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsAppender.java
Outdated
Show resolved
Hide resolved
...akarta-jms/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsAppender.java
Outdated
Show resolved
Hide resolved
...akarta-jms/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsAppender.java
Outdated
Show resolved
Hide resolved
...akarta-jms/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsAppender.java
Outdated
Show resolved
Hide resolved
...akarta-jms/src/main/java/org/apache/logging/log4j/core/appender/mom/jakarta/JmsAppender.java
Outdated
Show resolved
Hide resolved
For Jakarta, use the `JMS-Jakarta` element name in the `log4j-jakarta-jms` Maven module. | ||
For Javax, use the `JMS-Javax` element name; the names `JMS`, `JMSQueue`, and `JMSTopic` are provided for backward compatibility. | ||
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.
I think we could use the same technique as with the Servlet Appender: document only the Jakarta version and add a collapsible paragraph "Click here if you are using Jakarta EE 8 or any version of Java EE" (see Servlet Appender documentation).
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.
The collapsible UI to too lame to use IMO. It's hard to tell how much is expanded, maybe if it expanded into something with a border it would help. I did not want to click on the "Click here" text because I did not want to leave the page.
The true uselessness of the collapsible thingy is that when you search for text on a page in a web browser (Firefox in my case), the browser does not find the text inside the collapsed text, so using the collapsible thingy an anti-pattern as implemented (IMO). Or maybe Firefox found it but you certainly don't see it.
The new site is hard enough to use without this kind of UI to make it worse 😞... IMO
75475c2
to
e6392aa
Compare
Hi @ppkarwasz Ouch? For 2.x, reusing the "JMS" name will force users to migrate from Javax to Jakarta, this is going to be a surprise hidden change and break existing configurations. I don't think we should do that. The move to 3.x will require plenty of changes for non-trivial configurations IMO, especially when switching from Javax to Jakarta, adding this and that new Log4j modules that are now split out. So I'm OK with keeping the new name, supporting both styles, or renaming. ATM, I am only concerned about an IRL 2.x use case for JMS and Jakarta. For 3.x we can do whatever. WDYT?
|
Merging after discussion with @ppkarwasz. Keep it simple and no need for an extra mechanism to detect javax vs jakarta implementations on the classpath. |
Adds a Jakarta JMS Appender #2295
In order to complete an app stack's port from
javax
tojakarta
, I need to bejakarta
all the way.