You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/01/12 09:53:01 UTC

[04/18] logging-log4j2 git commit: added method #hasThreadName to assist performance optimization in ThreadPatternConverter

added method #hasThreadName to assist performance optimization in
ThreadPatternConverter

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e2f03ddc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e2f03ddc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e2f03ddc

Branch: refs/heads/LOG4J2-930
Commit: e2f03ddca3567e7f322fcb8c38b84c454db2532c
Parents: b66c93a
Author: rpopma <rp...@apache.org>
Authored: Mon Jan 12 17:26:58 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Jan 12 17:26:58 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/impl/Log4jLogEvent.java   | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e2f03ddc/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
----------------------------------------------------------------------
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 a4e4434..fff6f04 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.