Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B881BC7D1 for ; Mon, 29 Jul 2013 09:48:08 +0000 (UTC) Received: (qmail 43951 invoked by uid 500); 29 Jul 2013 09:48:08 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 43757 invoked by uid 500); 29 Jul 2013 09:48:07 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 43749 invoked by uid 99); 29 Jul 2013 09:48:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jul 2013 09:48:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jhuxhorn@googlemail.com designates 74.125.83.51 as permitted sender) Received: from [74.125.83.51] (HELO mail-ee0-f51.google.com) (74.125.83.51) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jul 2013 09:48:02 +0000 Received: by mail-ee0-f51.google.com with SMTP id c1so2755148eek.38 for ; Mon, 29 Jul 2013 02:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:content-transfer-encoding; bh=sdYObMOS9yl2Kl/F2+1u71F/kUybX++cg16vScicTTw=; b=vDM/QLPb+Kv5MmvaQA3hhHkmEDMSghR4kMl6ghcGeI7UISleEF5eW+oQvb/oQoLNBe WVQk6NsX+bnIZtDTEgJwBdVOcHpaAR/qyk0+u3VvCtP+HRnSB/o11Ce5Fsy+DLjLwqMW 0DailZN5idPqCt7A4eMC9M/SWu9Z51cXsYR4M0P9gn2HYmNjVUYK5wAbJYUU0e8ySvlp fTC+0gnX4WPJDKS7FtVC1ikiRrkelikpNrvc39IuLZjc2swZ9JHpzXZYL7jUFXp2HXG/ U3fS2dD+VBg0O6VSF8ywicAE88XTaDrErhGAu+c/TA42cr63cIoe5/bB/cI/SWvM7yBQ HeOw== X-Received: by 10.14.177.196 with SMTP id d44mr58366655eem.35.1375091261156; Mon, 29 Jul 2013 02:47:41 -0700 (PDT) Received: from LBFRA-0705-JHuxhorn-244-MBP15.local (h-213.61.241.82.host.de.colt.net. [213.61.241.82]) by mx.google.com with ESMTPSA id bj46sm100901517eeb.13.2013.07.29.02.47.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 29 Jul 2013 02:47:40 -0700 (PDT) Date: Mon, 29 Jul 2013 11:47:39 +0200 From: =?UTF-8?Q?J=C3=B6rn_Huxhorn?= To: Log4J Developers List Cc: Message-ID: In-Reply-To: <3B27DC37-53F0-4A8A-9594-9F5EC980B481@dslextreme.com> References: <3B27DC37-53F0-4A8A-9594-9F5EC980B481@dslextreme.com> Subject: =?UTF-8?Q?Re=3A_Relfection.getCallerClass?= X-Mailer: Airmail (183) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org I'm highly concerned about speed. The workaround in the logback pull-request has some benchmarks regarding = alternative ways to get the required info and those are quite shocking: > This solution was found from http://stackoverflow.com/questions/421280/= in-java-how-do-i-find-the-caller-of-a-method-using-stacktrace-or-reflecti= on and 1,000,000 calls of all alternatives were measured as follows : > Reflection: 10.195 ms. > Current Thread StackTrace: 5886.964 ms. > Throwable StackTrace: 4700.073 ms. > SecurityManager: 1046.804 ms. The =22best=22=C2=A0solution=C2=A0using SecurityManager is still 100x slo= wer than the original Reflection call while the Throwable solution is abo= ut 470x slower. D: This is a disaster, especially for our logging use-case with lots and lot= s of calls. This is also causing issues for Groovy=C2=A0http://jira.codehaus.org/brow= se/GROOVY-6279 but it's a lot less severe since the code won't get execut= ed nearly as often as in our case. My hope was that, together, we could probably make a difference. I also thought that a bigger =22audience=22 would increase the likeliness= that some of us knows one of the responsible persons personally - which = would probably have more impact than just a message on a mailing list. An= yway, I just subscribed to the core-list. Didn't even know about it. I ho= pe that =22open=22 in open-jdk isn't just PR=E2=80=A6 *sigh* Cheers, J=C3=B6rn. On 27. Juli 2013 at 17:53:19, Ralph Goers (ralph.goers=40dslextreme.com) = wrote: Thanks=C2=A0J=C3=B6rn, This was first reported to us in May in LOG4J2-245. =C2=A0Nick sent a mes= sage to the openjdk list at that time =5B1=5D but it seemed to be ignored= . =C2=A0How would you propose we convince Oracle=3F =C2=A0To be honest, I= would much prefer that I be able to get a stack trace from a Throwable t= hat has the Class objects in it, instead of just the class names. Ralph =5B1=5D=C2=A0http://mail.openjdk.java.net/pipermail/java-se-8-spec-commen= ts/2013-May/000014.html On Jul 26, 2013, at 2:43 AM, J=C3=B6rn Huxhorn wrote: Hi everyone. I wanted to inform you about the following Logback issues since their roo= t causes will also impact log4j: http://jira.qos.ch/browse/LOGBACK-885 https://github.com/qos-ch/logback/pull/136 In short: sun.reflect.Reflection.getCallerClass - changed behavior in Java7u25 since the stack frames have changed. http:= //bugs.sun.com/view=5Fbug.do=3Fbug=5Fid=3D8016814 - will throw an=C2=A0UnsupportedOperationException in upcoming Java7u40.=C2= =A0http://bugs.sun.com/view=5Fbug.do=3Fbug=5Fid=3D8014925 - will be removed in Java8 with no replacement. http://bugs.sun.com/view=5F= bug.do=3Fbug=5Fid=3D8020785 https://github.com/qos-ch/logback/pull/136 contains a way to get similar = informations but, unfortunately, it is 100x slower than=C2=A0sun.reflect.= Reflection.getCallerClass. http://bugs.sun.com/view=5Fbug.do=3Fbug=5Fid=3D8014925 contains the follo= wing text: =22JEP-176 proposes to remove sun.reflect.Reflection.getCallerClass(int) = that has incompatibility concern since there are existing applications de= pending on this private API such as Oracle Diagnostic Logging and jidesof= t library that breaks Oracle Primavera. The jdk part of JEP-176 has been backported to 7u25 but keep sun.reflect.= Reflection.getCallerClass(int) as the mitigration plan (JDK-8014745) in 7= u25. The following describes the transition plan to allow customers to migrate= their applications away from this private API: 1. Disable sun.reflect.Reflection.getCallerClass(int) in 7u40 and provide= a flag to re-enable it 2. Determine how this private API is being used and the use cases 3. Remove this private API if there is no valid use case or there is a pr= oper replacement for it. Allow at least 2 CPU releases to allow customers= to make appropriate change. =C2=A0So the earliest for the removal is 7u5= 5. =C2=A0If there are valid use cases but no proper replacement, we may k= eep this private API in jdk7u for longer.=22 I consider the use of this API in logging frameworks a very valid use cas= e, especially since the only replacements available would have severe imp= act on the performance (other techniques like generating a Stacktrace via= Throwable are even slower than the SecurityManager workaround in the pul= l request) - so we should probably all try to convince Oracle that a prop= er replacement, ideally in a public API, is needed. Cheers, J=C3=B6rn. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe=40logging.apache.org =46or additional commands, e-mail: log4j-dev-help=40logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org