質問

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"

役に立ちましたか?

解決 2

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

他のヒント

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top