You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/02/27 09:56:23 UTC
[logging-log4j2] 04/15: added method #hasThreadName to assist performance optimization in ThreadPatternConverter
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch scheduled-for-deletion/LOG4J2-930
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit e2f03ddca3567e7f322fcb8c38b84c454db2532c
Author: rpopma <rp...@apache.org>
AuthorDate: Mon Jan 12 17:26:58 2015 +0900
added method #hasThreadName to assist performance optimization in
ThreadPatternConverter
---
.../java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
index a4e44344ff..fff6f04c64 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
@@ -294,6 +294,15 @@ public class Log4jLogEvent implements LogEvent {
}
return threadName;
}
+
+ /**
+ * Returns {@code true} if the thread name attribute of this log event has been initialized, that is, the thread
+ * name of this event may be different from the current thread.
+ * @return {@code true} if the thread name attribute of this log event has been initialized, false otherwise
+ */
+ public boolean hasThreadName() {
+ return threadName != null;
+ }
/**
* Returns the time in milliseconds from the epoch when the event occurred.