users@jersey.java.net

[Jersey] Log4J Problem

From: Gökçen Güner <gokcen.guner_at_stigma.com.tr>
Date: Mon, 22 Aug 2011 17:28:19 +0300

Hello,
I've a webapp deployed to tomcat apache-tomcat-6.0.33 and I'm including
asm-3.1.jar, jersey-core-1.8.jar, jersey-server-1.8.jar,
commons-logging-api-1.1.1.jar and log4j-1.2.16.jar files in my Web-Inf/lib
directory. Below you can see the code. When I browse to the address of this
servlet in the browser I'm getting no error, it works. The problem is system
out and logger in constructor works but the ones in the sayPlainTextHello
method does not work. What I'm missing?

@Path("/hello")
public class Hello
{
private static Logger logger = Logger.getLogger(Hello.class);

public Hello()
 {
logger.error("error");
System.out.println("Hello Jersey");
}
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello()
 {
logger.error("error");
System.out.println("Hello Jersey");
return "Hello Jersey";
 }
}