0

I have a Restlet webservice and I want to remove the debug statements in the log that Restlet creates when a request is made. Currently I am using this code to redirect the Restlet logging to my log file instead of console output by doing this:

Slf4jLoggerFacade loggerFacade = new Slf4jLoggerFacade();
Engine.getInstance().setLoggerFacade(loggerFacade);

In my log4j.properties file I have this:

log4j.rootLogger=WARNING, LOGFILE

My problem is that it still shows the debug entries in the log saying that it received the requests. This causes the log file to be a huge file size because of all the debug statements.

I also tried this to remove the debug statements but it did not work:

Engine.setLogLevel(Level.WARNING);

as well as tried this:

Engine.setRestletLogLevel(Level.WARNING);

Why is my log4j.properties file not working?

Here is some debug entries from the log that I want to remove:

Nov 29 00:00:01 DEBUG org.restlet log Host: ip:8182
Nov 29 00:00:01 DEBUG org.restlet log Connection: keep-alive
Nov 29 00:00:01 DEBUG t.SpringComponent.ServerRouter fine Default virtual host selected
Nov 29 00:00:01 DEBUG t.SpringComponent.ServerRouter fine Base URI: "http://ip:8182". Remaining part: "/getFoo?foo=Foo%2Ffoo&fileName=foo.bin"

ColinMc
  • 1,238
  • 3
  • 16
  • 33

2 Answers2

2

could you precise some elements of the context : is the application running inside a servlet container? What kind of server connectors are you using? As I don't see clearly what kind of debug traces are put in logs could you provide a sample one? Are you still using Restlet-2.0?

Best regards, Thierry Boileau

  • This appears to be a [Restlet team member](http://www.restlet.com/company/team#thierry-boileau) and co-author of 'Restlet in Action'! @user1301115 you should add your name to your profile. :-) – Jonathan Nov 29 '12 at 08:50
  • @user1301115 The web service is not run inside a servlet container. It is standalone. I am using the default server connectors. I am using Restlet 2.1 JSE. Thanks for trying to help. :) – ColinMc Nov 29 '12 at 11:52
1

Solved it! It was not a Restlet issue more of a not knowing log4j well enough. I was setting the log4j level to WARNING instead of WARN. Here is my settings in the log4j that solved my problem. :)

log4j.rootLogger=ERROR, LOGFILE
log4j.logger.org.restlet=WARN
log4j.logger.org.springframework=WARN
ColinMc
  • 1,238
  • 3
  • 16
  • 33