Have not actually run any tests, but I would imagine that trace is a little slower than debug, but I can't imagine it would be that noticeable... though I have not run any benchmarks.
I am still not too convinced that using trace over debug is that important... especially with classes that only use trace and no debug. The same would be achieved by simply turning on and off debug for that class... at the same time I like having the extra level of separation... which allows us to provide rich debug information as we as terse debugging. The first would be useful to track down problems inside the server, while the second may be more useful to app designers to find out what is going on and not getting lost by the traffic. --jason On Wed, 2002-02-13 at 22:18, marc fleury wrote: > Is it more expensive to use log.trace? can we bypass the string creation > with trace? > > marcf > > |-----Original Message----- > |From: [EMAIL PROTECTED] > |[mailto:[EMAIL PROTECTED]]On Behalf Of Scott > |M Stark > |Sent: Tuesday, February 12, 2002 12:16 AM > |To: [EMAIL PROTECTED] > |Subject: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb > |Container.java StatefulSessionContainer.java > | > | > | User: starksm > | Date: 02/02/12 00:15:35 > | > | Modified: src/main/org/jboss/ejb Container.java > | StatefulSessionContainer.java > | Log: > | Change all use of log.debug to log.trace for method that are in the > | invocation path or associated with timers. Debug is only for O(1) > | messages. > | > | Revision Changes Path > | 1.72 +21 -33 jboss/src/main/org/jboss/ejb/Container.java > | > | Index: Container.java > | =================================================================== > | RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Container.java,v > | retrieving revision 1.71 > | retrieving revision 1.72 > | diff -u -r1.71 -r1.72 > | --- Container.java 6 Feb 2002 20:59:27 -0000 1.71 > | +++ Container.java 12 Feb 2002 08:15:35 -0000 1.72 > | @@ -78,7 +78,7 @@ > | * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> > | * @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>. > | * @author <a href="[EMAIL PROTECTED]">Bill Burke</a> > | -* @version $Revision: 1.71 $ > | +* @version $Revision: 1.72 $ > | * > | * <p><b>Revisions:</b> > | * > | @@ -543,50 +543,41 @@ > | * Handle a operation invocation. > | */ > | public Object invoke(String actionName, Object[] params, > |String[] signature) > | - throws MBeanException, ReflectionException > | - { > | - > | + throws MBeanException, ReflectionException > | + { > | if( params != null && params.length == 1 && (params[0] > |instanceof Invocation) == false ) > | throw new MBeanException(new > |IllegalArgumentException("Expected zero or single Invocation argument")); > | - > | + > | Object value = null; > | Invocation mi = null; > | if( params != null && params.length == 1 ) > | mi = (Invocation) params[0]; > | - > | + > | ClassLoader callerClassLoader = > |Thread.currentThread().getContextClassLoader(); > | + boolean trace = log.isTraceEnabled(); > | try > | { > | - Thread.currentThread().setContextClassLoader(this.classLoader); > | - > | - > | + > |Thread.currentThread().setContextClassLoader(this.classLoader); > | switch (mi.getType()) > | { > | - > | // Check against home, remote, localHome, local, > |getHome, getRemote, getLocalHome, getLocal > | case Invocation.REMOTE: > | - > | if (mi instanceof MarshalledInvocation) > | - > | { > | ((MarshalledInvocation) > |mi).setMethodMap(marshalledInvocationMapping); > | > | - if (log.isDebugEnabled()) > | - // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("METHOD REMOTE INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); > | - > | + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE > |INTEGRATED > | + if( trace ) > | + log.trace("METHOD REMOTE INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); > | } > | // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED > | else if > |(!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) > | { > | - > | - if (log.isDebugEnabled()) > | + if( trace ) > | { > | // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("METHOD REMOTE INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); > | - > | - // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("WARNING: YOU ARE RUNNING > |NON-OPTIMIZED"); > | + log.trace("METHOD REMOTE INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); > | + log.trace("WARNING: YOU ARE RUNNING > |NON-OPTIMIZED"); > | } > | > | // TEMP FIXME HACK This makes user > |transactions on the server work until > | @@ -624,24 +615,22 @@ > | > | ((MarshalledInvocation) > |mi).setMethodMap(marshalledInvocationMapping); > | > | - if (log.isDebugEnabled()) > | - // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("METHOD HOME INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArgume > |nts().toString()); > | + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE > |INTEGRATED > | + if( trace ) > | + log.trace("METHOD HOME INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArgume > |nts().toString()); > | > | } > | // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED > | else if > |(!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) > | { > | > | - if (log.isDebugEnabled()) > | + if( trace ) > | { > | // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("METHOD HOME INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArgume > |nts().toString()); > | - > | - // FIXME FIXME FIXME FIXME REMOVE WHEN CL > |ARE INTEGRATED > | - log.debug("WARNING: YOU ARE RUNNING > |NON-OPTIMIZED"); > | + log.trace("METHOD HOME INVOKE > |"+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArgume > |nts().toString()); > | + log.trace("WARNING: YOU ARE RUNNING > |NON-OPTIMIZED"); > | } > | - > | + > | // TEMP FIXME HACK This makes user > |transactions on the server work until > | // local invocations stop going through > |Marshalled Invocation > | Transaction hack = mi.getTransaction(); > | @@ -773,7 +762,7 @@ > | * and DataSource ressources. > | */ > | private void setupEnvironment() > | - throws DeploymentException > | + throws DeploymentException > | { > | boolean debug = log.isDebugEnabled(); > | try > | @@ -813,7 +802,6 @@ > | Iterator enum = beanMetaData.getEjbReferences(); > | while(enum.hasNext()) > | { > | - > | EjbRefMetaData ref = (EjbRefMetaData)enum.next(); > | if (debug) > | log.debug("Binding an EJBReference "+ref.getName()); > | > | > | > | 1.42 +14 -15 > |jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java > | > | Index: StatefulSessionContainer.java > | =================================================================== > | RCS file: > |/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v > | retrieving revision 1.41 > | retrieving revision 1.42 > | diff -u -r1.41 -r1.42 > | --- StatefulSessionContainer.java 9 Feb 2002 16:09:22 -0000 1.41 > | +++ StatefulSessionContainer.java 12 Feb 2002 08:15:35 -0000 1.42 > | @@ -31,7 +31,7 @@ > | * @author <a href="mailto:[EMAIL PROTECTED]">Rickard Öberg</a> > | * @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a> > | * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> > | -* @version $Revision: 1.41 $ > | +* @version $Revision: 1.42 $ > | * > | * <p><b>Revisions</b> > | * <p><b>20010704</b> > | @@ -675,23 +675,22 @@ > | public Object invokeHome(Invocation mi) > | throws Exception > | { > | - boolean debug = log.isDebugEnabled(); > | - if (debug) > | + boolean trace = log.isTraceEnabled(); > | + if (trace) > | { > | - log.debug("HOMEMETHOD coming in "); > | - log.debug(""+mi.getMethod()); > | - log.debug("HOMEMETHOD coming in > |hashcode"+mi.getMethod().hashCode()); > | - log.debug("HOMEMETHOD coming in > |classloader"+mi.getMethod().getDeclaringClass().getClassLoader().ha > |shCode()); > | - log.debug("CONTAINS > |"+homeMapping.containsKey(mi.getMethod())); > | + log.trace("HOMEMETHOD coming in "); > | + log.trace(""+mi.getMethod()); > | + log.trace("HOMEMETHOD coming in > |hashcode"+mi.getMethod().hashCode()); > | + log.trace("HOMEMETHOD coming in > |classloader"+mi.getMethod().getDeclaringClass().getClassLoader().ha > |shCode()); > | + log.trace("CONTAINS > |"+homeMapping.containsKey(mi.getMethod())); > | } > | > | Method m = (Method)homeMapping.get(mi.getMethod()); > | // Invoke and handle exceptions > | > | - if (debug) > | + if (trace) > | { > | - log.debug("HOMEMETHOD m "+m); > | - > | + log.trace("HOMEMETHOD m "+m); > | java.util.Iterator iterator = > |homeMapping.keySet().iterator(); > | while(iterator.hasNext()) > | { > | @@ -699,10 +698,10 @@ > | > | if (me.getName().endsWith("create")) > | { > | - log.debug(me.toString()); > | - log.debug(""+me.hashCode()); > | - > |log.debug(""+me.getDeclaringClass().getClassLoader().hashCode()); > | - log.debug("equals > |"+me.equals(mi.getMethod())+ " "+mi.getMethod().equals(me)); > | + log.trace(me.toString()); > | + log.trace(""+me.hashCode()); > | + > |log.trace(""+me.getDeclaringClass().getClassLoader().hashCode()); > | + log.trace("equals > |"+me.equals(mi.getMethod())+ " "+mi.getMethod().equals(me)); > | } > | } > | } > | > | > | > | > |_______________________________________________ > |Jboss-development mailing list > |[EMAIL PROTECTED] > |https://lists.sourceforge.net/lists/listinfo/jboss-development > > > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development