Reputation: 1922
I am building a webservice on Weblogic 10.3.3 and I am using a servlet filter to log the request to a database. I do not want the filter to slow down the call to the webservice. So I actually have 2 questions.
1) Does the filter, or can I make the filter do the logging on a separate thread? if so how?
2) is there a way I can dynamically turn the filter on or off without having to redeploy code.
Thanks
Upvotes: 0
Views: 1744
Reputation: 308938
You might be guilty of premature optimization here. If you logging or filtering stuff is going to be a problem, I'd wait until I had evidence to prove it before I'd start redesigning to fix it.
Upvotes: 5
Reputation: 269797
A lot of logging software supports "asynchronous logging", where a log event is put into a queue very quickly, and then a separate thread writes them to persistent storage as soon as it can. The drawback here is that you are more likely to lose messages if your app crashes while events are still in the queue. The overall overhead is slightly higher too, since you have multiple threads coordinating with each other.
Additionally, many logging frameworks have a "watch configuration" option that periodically checks a configuration file. This allows you to enable or disable a logger on a "hot" system.
What logging library are you using?
Upvotes: 0