[seek-dev] changing ecogrid server side to use commons-logging.

Kevin Ruland kruland at ku.edu
Wed Sep 7 12:12:12 PDT 2005


Jing,

Globus grid services use commons-logging/log4j infrastructure for all
its output.  I decided to make the Digir implementation follow these
lines because it allows easier configuration of log messages.  Matt
suggested it we should try to move all the ecogrid server code to using
this logging mechanism.  Allow me the chance to highlight the changes
needed for this.

Where before in DigirProxyImpl, it would do this:

import org.ecoinformatics.ecogrid.EcogridUtils;

public class DigirProxyImpl implements
EcoGridQueryInterfaceLevelOnePortType {

 public DigirProxyImpl()
 {
  EcogridUtils.setDebug(true);
  EcogridUtils.debugMessage( "DigirProxyImpl Constructor", 1 );
 }
}


It now looks like this:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DigirProxyImpl implements
EcoGridQueryInterfaceLevelOnePortType {
    static Log logger  = LogFactory.getLog( DigirProxyImpl.class.getName());

  public DigirProxyImpl()
  {
    if (Logger.isDebugEnabled()) {
     logger.debug("DigirProxyImpl Constructor" );
   }
  }
}

In reality the test for isDebugEnabled() is not required, but it does
provide performance improvement if the message arguments are expensive
to construct.  In this example, it would read much better without it.

In order to enable logging in the deployed server, you need to correct
one problem that ogsa's ant deployTomcat introduces.  You need to mv
webapps/ogsa/WEB-INF/ogsilogging.properties to
webapps/ogsa/WEB-INF/classes/ogsilogging.properties.  I corrected the
globus build-services.xml to copy it into the correct location to begin
with.

Now in order to enable debug level for your class you need to insert a
line in the ogsilogging.properties:

org.ecoinformatics.ecogrid.digir.impl.DigirProxyImpl=console,debug

All the log messages sent to console end up in catalina.out.  There
should be a way to configure the logging properties to redirect to a
different file, but I haven't needed to so didn't look for the answer.

Kevin


More information about the Seek-dev mailing list