hi,

  I wrote a globus wsrf service in my project. When I tested it, I met
a logging problem.
  I used $GLOBUS_LOCATION/log4j.properties as my log4j file, and its content:

# Set root category priority to WARN and its only appender to A1.
log4j.rootCategory=INFO, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2}
[%t,%M:%L] %m%n
# Display any warnings generated by our code
log4j.category.org.globus=WARN
# added by me
log4j.category.hit.pact.crawler.common.Globals=INFO
# added by me
log4j.category.pact.grid=INFO
# Enable SOAP Message Logging
# log4j.category.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG
# Comment out the line below if you want to log every authorization
# decision the notification consumer makes.
log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=WARN

I am using GDT and my service code is like:

public class MyService {

     static {
           System.out.println("this is a test.");
           Globals.logger.info("hello");
           <several important initializing operations>
     }

      @GridMethod public String submit(String input){...};

}

the logging code is in the static block, so it will be called only
when a client calls the service for the first time.

and this is the implementation of class Globals:

package hit.pact.crawler.common;
public class Globals {
      public static final Log logger = LogFactory.getLog(Globals.class);
}

also I had another implementation of Globals which is like:

package hit.pact.crawler.common;
public class Globals {
      public static Logger logger = Logger.getLogger(Globals.class.getName());
      static {
                org.apache.log4j.PropertyConfigurator.configure(<path of 
globus's
log4j.properties>);
        }
}

when I use a client to call this service, the first line in the
service's static block prints out the message and then the whole
container process suspends in the second line. It must be something
wrong with the logging method. I have tested the two implementations
of Globals and it's always the same. The container process does NOT
stop or terminate or print out any message.

I have tested class Globals in a non web service version of my
project, and the two implementations works fine.

If the problem remains I will not finish my project in time.Can you
tell me what's wrong. If you give me a correct sample of how to use
log4j in globus wsrf service, it will be highly appreciated.

Thanks.

Reply via email to