Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 20862 invoked from network); 23 Jul 2002 21:06:58 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 23 Jul 2002 21:06:58 -0000 Received: (qmail 22675 invoked by uid 97); 23 Jul 2002 21:07:19 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 22659 invoked by uid 97); 23 Jul 2002 21:07:19 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 22647 invoked by uid 98); 23 Jul 2002 21:07:18 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Subject: [logging] PATCH] JDK 1.4 Logging From: Bob Herrmann To: jakarta-commons-dev@apache.org Content-Type: multipart/mixed; boundary="=-VYVoODF68cb+bWs7CNiE" X-Mailer: Ximian Evolution 1.0.8 Date: 23 Jul 2002 17:10:10 -0400 Message-Id: <1027458610.1897.113.camel@dhcp-70-230> Mime-Version: 1.0 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=-VYVoODF68cb+bWs7CNiE Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, 2002-07-23 at 15:03, Bob Herrmann wrote: > On Mon, 2002-07-22 at 14:18, costinm@covalent.net wrote: > > > > I think there is a simpler solution for this class of problems, and > > that would also work with log4j and doesn't require _any_ API change. > > ( only changes to the adapter implementations ) > > > > Any 'wrapper' will use: > > factory=LogFactory.getFactory(); > > > > factory.setAttribute( "commons-logging.wrapperClass", > > "[CLASSNAME-OF-WRAPPER]"); > > factory.getLog(), etc. > Hi. This patch to commons logging allow you to specify which methods in the call stack are uninteresting when using the JDK1.4 Logger. In Tomcat this seems to be all methods named "log" and "internalLog." This is based on Costin's idea of uninteresting classes, but seems to work better for method names (in Tomcat anyway.) It is something of a back door. It is primarily for projects that are in the process of converting to using commons-logging. Is this an acceptable change to commons-logging ? Cheers, -bob P.S. this patch is updated from the one posted to tomcat-dev --=-VYVoODF68cb+bWs7CNiE Content-Disposition: attachment; filename=patch.txt Content-Transfer-Encoding: quoted-printable Content-Type: text/x-patch; name=patch.txt; charset=ISO-8859-15 Index: src/java/org/apache/commons/logging/impl/Jdk14Logger.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/jakarta-commons/logging/src/java/org/apache/commo= ns/logging/impl/Jdk14Logger.java,v retrieving revision 1.4 diff -u -r1.4 Jdk14Logger.java --- src/java/org/apache/commons/logging/impl/Jdk14Logger.java 17 Jul 2002 1= 6:42:40 -0000 1.4 +++ src/java/org/apache/commons/logging/impl/Jdk14Logger.java 23 Jul 2002 2= 0:49:11 -0000 @@ -65,8 +65,11 @@ =20 import java.util.logging.Level; import java.util.logging.Logger; +import java.util.Hashtable; +import java.util.StringTokenizer; =20 import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; =20 =20 /** @@ -95,6 +98,14 @@ =20 logger =3D Logger.getLogger(name); =20 + String wrapperMethods =3D (String) LogFactory.getFactory().getAttr= ibute("commons-logging.wrapperMethods"); + if ( wrapperMethods !=3D null ){ + StringTokenizer st =3D new StringTokenizer(wrapperMethods,",")= ; + while (st.hasMoreTokens()) { + wrapperMethodsHash.put( st.nextToken(), "F" ); + } + } + } =20 =20 @@ -106,6 +117,11 @@ */ protected Logger logger =3D null; =20 + /** + * The methods that we ignore in the stack trace + */ + private Hashtable wrapperMethodsHash =3D new Hashtable(); + =20 // --------------------------------------------------------- Public Me= thods =20 @@ -116,10 +132,17 @@ // Caller will be the third element String cname=3D"unknown"; String method=3D"unknown"; - if( locations!=3Dnull && locations.length >2 ) { - StackTraceElement caller=3Dlocations[2]; - cname=3Dcaller.getClassName(); - method=3Dcaller.getMethodName(); + if( locations!=3Dnull && locations.length>2 ) { + StackTraceElement caller=3Dnull; + for (int stackLevel=3D2;stackLevel For additional commands, e-mail: --=-VYVoODF68cb+bWs7CNiE--