0

I would like to log all request and response bodies and the headers for a restlet service.

For example, the following java options allow you to configure detailed logging on an Axis2 service:

JAVA_OPTS=
 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog 
 -Dorg.apache.commons.logging.simplelog.showdatetime=true  
 -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug 
 -Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug

How can I configure similar with Restlet 2? Preferably I should be able to configure logging, and not have to write code to achieve my goal.

Chris Snow
  • 23,813
  • 35
  • 144
  • 309

1 Answers1

0

You should consider using something like that:

-Dlog4j.configuration=file:///pathto/log4j.properties

with the following configuration:

# Root logger option
log4j.rootLogger=INFO, stdout
log4j.org.restlet=DEBUG, stdout

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Hope it helps, Thierry

Thierry Templier
  • 198,364
  • 44
  • 396
  • 360