gemmellr commented on code in PR #4237:
URL: https://github.com/apache/activemq-artemis/pull/4237#discussion_r983656021
##########
artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/AbstractPrincipalLoginModule.java:
##########
@@ -31,12 +31,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.invoke.MethodHandles;
/**
* Abstract login module that uses an external authenticated principal
*/
public abstract class AbstractPrincipalLoginModule implements AuditLoginModule
{
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ private static final Logger logger =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Review Comment:
Basically all this is doing by using getClass() as the key is sharing a
logger name (which various places in the codebase do with the code loggers, by
using the package name as the key), so that all the logging for a given
LoginModule all comes out the same logger name and can be reasoned about as a
unit.
If you make this class have a static logger like this youll also need to
change all the log messages themselves to better reflect what module they are
logging about or you simply wont be able to tell which the logging is about
unless there is only one. Passing a logger for such cases is not that unusual,
it is done elsewhere in the codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]