carterkozak commented on a change in pull request #480:
URL: https://github.com/apache/logging-log4j2/pull/480#discussion_r603671718
##########
File path:
log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/SystemClock.java
##########
@@ -16,13 +16,19 @@
*/
package org.apache.logging.log4j.core.time.internal;
+import java.time.Instant;
+
import org.apache.logging.log4j.core.time.Clock;
+import org.apache.logging.log4j.core.time.MutableInstant;
+import org.apache.logging.log4j.core.time.PreciseClock;
/**
* Implementation of the {@code Clock} interface that returns the system time.
+ * @since 2.11.0
*/
+// Precise clock is not implemented because the instant() method in the init
method is not garbage free.
Review comment:
Hmm, this would result in a regression in some places, we use
microsecond precision everywhere at this point at work since events can be
scrambled within millisecond buckets by our indexer. I suspect we'd be better
of implementing PreciseClock and updating our tests, but I have a very specific
use case. Either way we should swing back to add another clock implementation
to support whichever implementation SystemClock does not.
##########
File path:
log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java
##########
@@ -93,158 +41,55 @@ public static StackLocator getInstance() {
private StackLocator() {
}
- // TODO: return Object.class instead of null (though it will have a null
ClassLoader)
- // (MS) I believe this would work without any modifications elsewhere, but
I could be wrong
-
- // migrated from ReflectiveCallerClassUtility
- @PerformanceSensitive
- public Class<?> getCallerClass(final int depth) {
- if (depth < 0) {
- throw new IndexOutOfBoundsException(Integer.toString(depth));
- }
- if (GET_CALLER_CLASS == null) {
- return null;
- }
- // note that we need to add 1 to the depth value to compensate for
this method, but not for the Method.invoke
- // since Reflection.getCallerClass ignores the call to Method.invoke()
- try {
- return (Class<?>) GET_CALLER_CLASS.invoke(null, depth + 1 +
JDK_7u25_OFFSET);
- } catch (final Exception e) {
- // theoretically this could happen if the caller class were native
code
- // TODO: return Object.class
- return null;
- }
+ public Class<?> getCallerClass(final String fqcn) {
+ return getCallerClass(fqcn, "");
}
- // migrated from Log4jLoggerFactory
- @PerformanceSensitive
public Class<?> getCallerClass(final String fqcn, final String pkg) {
return getCallerClass(fqcn, pkg, 0);
}
- @PerformanceSensitive
Review comment:
Can we retain these annotations?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]