We are using OpenEJB clients that connect to one OpenEJB server container. The OpenEJB servers are managed by Corosync and Pacemaker for fail-over operation. Whenever an OpenEJB instance fails (caused by network, hardware, JVM or other problems) Corosync+Pacemaker starts another OpenEJB server instance in another machine. The process is relatively fast so that this is not a problem for our use cases.
Although OpenEJB provides a native fail-over mechanism, we still chose to manage it with our own mechanism, because that way we can better control the client. Everything is working as expected, except for the client logging that is too verbose. We would like to either turn it off or fine tune it in order to disable connection failure messages, such as this:
22/08/2011 14:06:23 org.apache.openejb.client.StickyConnectionStrategy connect AVISO: Failover: Cannot connect to server(s): ejbd://192.168.1.5:4201 Exception: Cannot connect to server 'ejbd://192.168.1.5:4201'. Check that the server is started and that the specified serverURL is correct.. Trying next.
I've already tried to decrease the logging level for log4j in the OpenEJB 开发者_StackOverflow社区client, but I failed. According to the log4j documentation and to this post it should be a matter of setting the desired level to "error" or "fatal". The question is, what is the category name?
I've already tried:
- p.put("log4j.category.OpenEJB.client", "error");
- p.put("log4j.category.OpenEJB", "error");
But nothing has changed. So, what property do I need to use to turn those WARN messages off?
The client uses java.util.logging so should be configurable via whatever mechanism is hooked up to that.
Just to put the information together. In order to control the logging mechanism for OpenEJB client one has to configure the regular Java Logger:
//Get the logger
Logger logger=Logger.getLogger("OpenEJB.client");
//Change its behavior...
logger.setLevel(Level.SEVERE);
That's it.
精彩评论