RemoteLogger question

12 views
Skip to first unread message

thomas.fr

unread,
Oct 30, 2008, 1:14:49 PM10/30/08
to gwt-log
Hello,

I am using GWT 2.5.2 and gwt-log 2.5.2.
When I want to log a trace with the RemoteLogger, the trace appears
correctly but a "null" line also appears.
How can I fix it ?

Thanks.
Thomas.

Fred Sauer

unread,
Oct 30, 2008, 11:55:07 PM10/30/08
to gwt...@googlegroups.com
Thomas,

Thanks for the report. While this was already fixed on the trunk (r269), the fix had not yet been released. I've back ported the fix (r286) for GWT 1.5.3.

Please try the new gwt-log-2.5.3 jar available here:

thomas.fr

unread,
Oct 31, 2008, 5:20:39 AM10/31/08
to gwt-log
Hello,

Thanks for your message.
I am using now your new jar with GWT 1.5.3 but I get the exception (I
don't modify neither my code nor the XML configuration) :

Failed to log message due to java.lang.NullPointerException
java.lang.NullPointerException
at
com.allen_sauer.gwt.log.server.UnwrappedClientThrowable.<init>(UnwrappedClientThrowable.java:
42)
at
com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl.info(RemoteLoggerServiceImpl.java:
70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
527)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
164)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
at
dp.ihm.authentication.CertificateFilter.doFilter(CertificateFilter.java:
123)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
210)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
703)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)

Thanks in advance for your help.
Thomas.

thomas.fr

unread,
Oct 31, 2008, 8:59:36 AM10/31/08
to gwt-log
More information : this exception occurs on the line :
Log.info("Test");

When I specify a second parameter like this : Log.info("Test", new
Throwable("test")); it works.

Fred Sauer

unread,
Oct 31, 2008, 9:48:52 AM10/31/08
to gwt...@googlegroups.com
Any chance you have an old (2.5.2 ?) gwt-log jar on your path? Line 42 of UnwrappedClientThrowable should in 2.5.3 be a blank line (i.e. no source to blow up on).

thomas.fr

unread,
Oct 31, 2008, 11:50:46 AM10/31/08
to gwt-log
Fred,

I clean all my project deleting all gwt-log config and jar.
I test my project == OK.

Then I introduce gwt-log 2.5.3 (last jar) again in my project and
rebuild it.
I get the same exception.

thomas.fr

unread,
Oct 31, 2008, 12:06:26 PM10/31/08
to gwt-log
Fred,

On my PC, I get the exception.
On my test environment, I don't get the exception, everything is OK.
So, I think your jar is OK, I'll analyze why I get the exception on my
PC.

Thomas.

Fred Sauer

unread,
Oct 31, 2008, 2:14:23 PM10/31/08
to gwt...@googlegroups.com
Do you have an Eclipse launch config? You might have the old jar specified there.

You might try clearing out any temporary files from the GWT or Java compiler.


Fred Sauer
fr...@allen-sauer.com

thomas.fr

unread,
Nov 3, 2008, 4:05:53 AM11/3/08
to gwt-log
Fred,

That's what I made but the problem is still there on my PC (indeed
with Eclipse config).
I don't understand why.

Thomas.

thomas.fr

unread,
Nov 3, 2008, 4:15:21 AM11/3/08
to gwt-log
Fred,

I find where the problem is !
The old jar war in my Tomcat Eclipse server lib, I delete it and all
is OK.

Thanks for your help
Thomas.

JT

unread,
Nov 6, 2008, 3:12:04 PM11/6/08
to gwt-log
Fred,

Is it possible to call the RemoteLogger just by itself without the
other enabled loggers?

I would like to log uncaught exceptions in the client on the server
only.
I have tried calling the RemoteLogger as follows (without success):

GWT.setUncaughtExceptionHandler(new
GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
Logger remoteLogger =
Log.getLogger(RemoteLogger.class);
remoteLogger.fatal("Uncaught exception", e);
}
});

Thanks in advance.

Justin.

Fred Sauer

unread,
Nov 6, 2008, 4:04:53 PM11/6/08
to gwt...@googlegroups.com
Sure,

Just disable all the other loggers in your .gwt.xml file, leaving on the remote logger enabled.

Fred Sauer
fr...@allen-sauer.com

Fred Sauer

unread,
Nov 6, 2008, 4:26:41 PM11/6/08
to gwt...@googlegroups.com
Sure,

Just disable all the other loggers in your .gwt.xml file, leaving on the remote logger enabled.

Fred Sauer
fr...@allen-sauer.com


On Thu, Nov 6, 2008 at 1:12 PM, JT <jtma...@gmail.com> wrote:

JT

unread,
Nov 6, 2008, 5:00:38 PM11/6/08
to gwt-log
Fred,

I was hoping to leave the existing logging the way it was, but now
only log on the server uncaught exceptions from the client.

I guess another way of saying it is, is it possible to only use the
Remote Logging when needed. Instead of using Log.debug(msg, t) can we
use something like new RemoteLogger().debug(msg, t); to send a
message to the server instead?

Thanks,

Justin.

Fred Sauer

unread,
Nov 6, 2008, 6:14:47 PM11/6/08
to gwt...@googlegroups.com
Justin,

There's the getLogger() static method on the Log class you could use to obtain a reference to the RemoteLogger. You wouldn't be using the logger in quite the intended way, but it should get you want you are looking for.
  /**
   * @param clazz the class of the desired logger
   * @param <T> the desired type of the {@link Logger}
   * @return the desired logger instance or <code>null</code> if no such longer exists
   */
  public static <T extends Logger> T getLogger(Class<T> clazz) {
    return impl.getLogger(clazz);
  }
HTH
Fred Sauer
fr...@allen-sauer.com
Reply all
Reply to author
Forward
0 new messages