2012/2/9 <[email protected]>:
> Author: markt
> Date: Thu Feb 9 16:16:49 2012
> New Revision: 1242374
>
> URL: http://svn.apache.org/viewvc?rev=1242374&view=rev
> Log:
> Fix a couple of issues with the UserDataHelper
> 1. Packaging. It should have been packaged with juli-adapters.jar. The
> class has been moved so this is no longer an issue.
> 2. The wrong class/method was reported if the extras were used. The
> logging code has been pushed back to the caller. In return for a small
> amount of code duplication, the caller class/method will now always be
> correct.
>
> Added:
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/UserDataHelper.java
> - copied unchanged from r1242371,
> tomcat/trunk/java/org/apache/tomcat/util/log/UserDataHelper.java
> Removed:
> tomcat/tc7.0.x/trunk/java/org/apache/juli/logging/UserDataHelper.java
> Modified:
> tomcat/tc7.0.x/trunk/ (props changed)
> tomcat/tc7.0.x/trunk/build.xml
> tomcat/tc7.0.x/trunk/java/org/apache/juli/logging/DirectJDKLog.java
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java
> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>
Good. Reverting the trick in DirectJDKLog aligns it with pristine
commons-logging code. The code added to Cookies/Parameters classes is
less scary than I thought it would be.
> --- tomcat/tc7.0.x/trunk/java/org/apache/juli/logging/DirectJDKLog.java
> (original)
> +++ tomcat/tc7.0.x/trunk/java/org/apache/juli/logging/DirectJDKLog.java Thu
> Feb 9 16:16:49 2012
> @@ -172,26 +172,13 @@ class DirectJDKLog implements Log {
> Throwable dummyException=new Throwable();
> StackTraceElement locations[]=dummyException.getStackTrace();
> // Caller will be the third element (or later if logger is
> wrapped)
The "or later" part of the above comment should be removed as well.
It was brought in by r1212093 [1] but it is no more relevant, because
you reverted the code.
[1]
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/juli/logging/DirectJDKLog.java?r1=1155369&r2=1212093&diff_format=h
> - String cname = null;
> - String method = null;
> - if (locations != null) {
> - int i = 2;
> - while (locations.length > i) {
> - StackTraceElement caller = locations[i];
> - if (caller.getClassName().startsWith("org.apache.juli"))
> {
> - i++;
> - } else {
> - cname = caller.getClassName();
> - method = caller.getMethodName();
> - break;
> - }
> - }
> + String cname = "unknown";
> + String method = "unknown";
> + if (locations != null && locations.length >2) {
> + StackTraceElement caller = locations[2];
> + cname = caller.getClassName();
> + method = caller.getMethodName();
> }
> - if (cname == null) {
> - cname = "unknown";
> - method = "unknown";
> - }
> -
> if (ex==null) {
> logger.logp(level, cname, method, msg);
> } else {
>
(...)
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]