oxsean commented on code in PR #15448:
URL: https://github.com/apache/dubbo/pull/15448#discussion_r2141770522
##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java:
##########
@@ -43,7 +44,7 @@
public class LoggerFactory {
private static final ConcurrentMap<String, FailsafeLogger> LOGGERS = new
ConcurrentHashMap<>();
- private static final ConcurrentMap<String, FailsafeErrorTypeAwareLogger>
ERROR_TYPE_AWARE_LOGGERS =
+ private static final ConcurrentMap<Pair<String, Object>,
FailsafeErrorTypeAwareLogger> ERROR_TYPE_AWARE_LOGGERS =
Review Comment:
ConcurrentMap<Object, FailsafeErrorTypeAwareLogger>
##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerAdapter.java:
##########
@@ -43,6 +44,18 @@ public interface LoggerAdapter {
*/
Logger getLogger(String key);
+ /**
+ * Get a logger
+ *
+ * @param pair the left of the pair is the full qualified class name of
caller,
+ * the right of it is clazz or key that the returned logger
will be named after.
+ * @return logger
+ */
+ default Logger getLogger(Pair<String, Object> pair) {
Review Comment:
The previous version was clearer.
##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java:
##########
@@ -178,8 +179,8 @@ public static Logger getLogger(String key) {
public static ErrorTypeAwareLogger getErrorTypeAwareLogger(Class<?> key) {
return ConcurrentHashMapUtils.computeIfAbsent(
ERROR_TYPE_AWARE_LOGGERS,
- key.getName(),
- name -> new
FailsafeErrorTypeAwareLogger(loggerAdapter.getLogger(name)));
+ Pair.of(FailsafeLogger.class.getName(), key),
Review Comment:
No changes necessary.
##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java:
##########
@@ -190,7 +191,37 @@ public static ErrorTypeAwareLogger
getErrorTypeAwareLogger(Class<?> key) {
*/
public static ErrorTypeAwareLogger getErrorTypeAwareLogger(String key) {
return ConcurrentHashMapUtils.computeIfAbsent(
- ERROR_TYPE_AWARE_LOGGERS, key, k -> new
FailsafeErrorTypeAwareLogger(loggerAdapter.getLogger(k)));
+ ERROR_TYPE_AWARE_LOGGERS,
Review Comment:
No changes necessary.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]