-
1. Configure the client logging done by the Errai Bus
heiko.braun Mar 10, 2011 3:25 AM (in response to joeb)I guess you refer to an application build with workspaces, right?
In that case it cannot simply be disabled, at least there is no option in terms of API
or configuration. But you can simply grab a copy of the source code, and patch it yourself:
https://github.com/errai/errai
And yes, it uses the Allen Sauer log impl.
-
2. Configure the client logging done by the Errai Bus
joeb Mar 10, 2011 6:38 AM (in response to heiko.braun)Thanks for the response, Heiko. Our application does not use workspaces. It's just a vanilla GWT application running in Tomcat in which we've included Errai Bus for its great messaging support.
Can I configure the Allen Sauer log which Errai Bus uses so that the floating DIV logger is disabled or shown a different way (e.g. within one of my panels in the app)?
e.g. Can I add statements in our app's gwt.xml file that will apply to Errai Bus?
<set-property name="log_DivLogger" value="DISABLED" />
-- Joe
-
3. Configure the client logging done by the Errai Bus
heiko.braun Mar 10, 2011 6:46 AM (in response to joeb)I am wondering where the div logger actually comes from. But yes, you should even be able to override this property in a custom module descriptor.
But am not 100% sure about this.
Are you sure not to import the workspaces module somewhere? That's the only case I can think of why the div logger might visible at all.
-
4. Configure the client logging done by the Errai Bus
joeb Mar 10, 2011 11:21 AM (in response to heiko.braun)Unfortunately it doesn't appear to work. I tried adding the allen-sauer log (v3.0.4) to our app (GWT 2.1.0) and configuring it to disable the DivLogger, but Errai Bus is still bringing up its DivLogger. Note: the quick test is to simply hit the browser's Reload button, which briefly shows an ErraiBus exception (from ClientMessageBusImpl:879) in a DivLogger before the page reloads.
Our app inherits the ErraiBus module in our gwt.xml file as follows:
<inherits name='org.jboss.errai.bus.ErraiBus'/>
We include the following JARs from the ErraiBus distribution in our app's war/WEB-INF/lib:
- errai-bus.jar
- errai-common.jar
- errai-tools.jar
- google-collections.jar
- guice.jar
- mvel2.jar
- reflections.jar
We do not include errai-workspaces.jar.
-
5. Configure the client logging done by the Errai Bus
joeb Mar 10, 2011 1:13 PM (in response to joeb)Let me ask a related question: is there a way for me to register a "global error handler" with the client Errai Bus so that my code gets called on any generic errors? That would allow me to handle them in a way that suits me...
-
6. Configure the client logging done by the Errai Bus
cbrock Mar 10, 2011 3:42 PM (in response to joeb)There is no support for a global error handler, but that's definitely a feature I feel we should support.
-
7. Configure the client logging done by the Errai Bus
joeb Mar 10, 2011 3:52 PM (in response to cbrock)Thanks for the info, Christopher.
After looking into this a little further, I'm beginning to think that the popup window displayed on an ErraiBus error isn't the allen-sauer log but is instead a custom window perhaps written in the Errai codebase. Here's a screenshot of an example popup window:
This doesn't look like the allen-sauer DIV logger. Is this something written by the Errai developers, and if so is there a way for me to configure its behavior?
-
8. Configure the client logging done by the Errai Bus
cbrock Mar 10, 2011 3:57 PM (in response to joeb)Yes, that is a plain error window the bus displays if no other error logger is configured. You can replace the LogAdapter with ClientMessageBusImpl.setLogAdapter()
-
9. Re: Configure the client logging done by the Errai Bus
joeb Mar 10, 2011 9:36 PM (in response to cbrock)Eureka, that did it! Thanks again to Christopher and Heiko.
To help anybody else who might want to do the same thing (hide the ErraiBus error window), here's a snippet from my code:
private static class GneErraiLogAdaptor implements LogAdapter {
private static final String CLASS_NAME = "GneErraiLogAdaptor: ";
/* (non-Javadoc)
* @see org.jboss.errai.bus.client.framework.LogAdapter#warn(java.lang.String)
*/
@Override
public void warn(String message) {
Log.warn(CLASS_NAME + message);
}
/* (non-Javadoc)
* @see org.jboss.errai.bus.client.framework.LogAdapter#info(java.lang.String)
*/
@Override
public void info(String message) {
Log.info(CLASS_NAME + message);
}
/* (non-Javadoc)
* @see org.jboss.errai.bus.client.framework.LogAdapter#debug(java.lang.String)
*/
@Override
public void debug(String message) {
Log.debug(CLASS_NAME + message);
}
/* (non-Javadoc)
* @see org.jboss.errai.bus.client.framework.LogAdapter#error(java.lang.String, java.lang.Throwable)
*/
@Override
public void error(String message, Throwable t) {
Log.error(CLASS_NAME + message, t);
}
}
[...]
ClientMessageBus clientMsgBus = (ClientMessageBus)erraiBus;
clientMsgBus.setLogAdapter(new GneErraiLogAdaptor());
-
10. Re: Configure the client logging done by the Errai Bus
heiko.braun Mar 11, 2011 3:11 AM (in response to joeb)Right, I did completely forget that I implemented the LogAdapter a while ago
-
11. Re: Configure the client logging done by the Errai Bus
cristianmiranda Nov 18, 2013 8:48 AM (in response to heiko.braun)Hi guys, I'm having the same issue with Errai 2.4.2.Final.
Here I don't have LogAdapter and clientMsgBus.setLogAdapter() to solve this problem.
Any ideas?
-
12. Re: Configure the client logging done by the Errai Bus
mbarkley Nov 25, 2013 3:55 PM (in response to cristianmiranda)Hi Cristian,
To disable the popup logger you can add this to your *.gwt.xml:
<set-property name="gwt.logging.consoleHandler" value="DISABLED"/>
You can find out about more configurations here.
Cheers.
-
13. Re: Configure the client logging done by the Errai Bus
cristianmiranda Nov 25, 2013 11:34 PM (in response to mbarkley)Thank you Max!