You can influence the logger GWT will use. See the logic here: http://code.google.com/p/gwt-log/source/browse/Log/server/com/allen_sauer/gwt/log/client/Log.java#39
Note that if log4j is not on the classpath, it will not be used. So, if you leave out the log4j.jar you should get java.util.logging by default. As for the references to the GWT code, there's a gwt-servlet-*.jar which is intended to be used server side, but might work in your Android client code as well. Let me know how it goes. On Fri, Nov 4, 2011 at 9:30 AM, Andy Dennie <[email protected]>wrote: > Is it possible to use gwt-log in a native Android app? I have some code > that is shared between my Android app, a GAE service, and a GWT client, and > I'm trying to use gwt-log within that code (I'd use slf4j if I could, since > I'm using it everywhere else, but it doesn't work in GWT as far as I can > tell). > > So, I'm trying to have gwt-log route to j.u.l in the Android app, then > reroute that to slf4j using the jul-to-slf4j bridge, and from there to the > Android logger using slf4j-android. > > Here's what's happening, though (see log output below): > > First, it looks like gwt-log is trying to make log4j calls. Is there a > way to tell it to use j.u.l instead, so it uses the jul-to-slf4j bridge? > Second, it's trying to load com.google.gwt.core.client.GWT, which is > obviously not present, and it doesn't seem like it should be added. Just > for the heck of it, I did try adding it, but trying to build the project > after that blew out the JVM's memory. > > Thoughts/advice? Much appreciated. > > -AndyD > > 11-04 16:15:06.423: WARN/dalvikvm(367): VFY: unable to resolve static > method 13432: Lorg/apache/log4j/Logger;.getLogger > (Ljava/lang/String;)Lorg/apache/log4j/Logger; > 11-04 16:15:06.462: WARN/dalvikvm(367): VFY: unable to resolve virtual > method 13430: Lorg/apache/log4j/Logger;.getEffectiveLevel > ()Lorg/apache/log4j/Level; > 11-04 16:15:06.463: WARN/dalvikvm(367): VFY: unable to resolve virtual > method 13433: Lorg/apache/log4j/Logger;.isDebugEnabled ()Z > 11-04 16:15:06.473: WARN/dalvikvm(367): VFY: unable to resolve static > field 3181 (ERROR) in Lorg/apache/log4j/Level; > 11-04 16:15:06.553: WARN/dalvikvm(367): VFY: unable to resolve static > field 3182 (FATAL) in Lorg/apache/log4j/Level; > 11-04 16:15:06.553: WARN/dalvikvm(367): VFY: unable to resolve static > field 3183 (INFO) in Lorg/apache/log4j/Level; > 11-04 16:15:06.553: WARN/dalvikvm(367): VFY: unable to resolve virtual > method 13431: Lorg/apache/log4j/Logger;.getLevel ()Lorg/apache/log4j/Level; > 11-04 16:15:06.553: WARN/dalvikvm(367): VFY: unable to resolve virtual > method 13435: Lorg/apache/log4j/Logger;.isTraceEnabled ()Z > 11-04 16:15:06.553: WARN/dalvikvm(367): VFY: unable to resolve static > field 3184 (WARN) in Lorg/apache/log4j/Level; > 11-04 16:15:06.564: WARN/dalvikvm(367): VFY: unable to resolve static > method 13438: Lorg/apache/log4j/MDC;.put > (Ljava/lang/String;Ljava/lang/Object;)V > 11-04 16:15:06.564: WARN/dalvikvm(367): VFY: unable to resolve static > method 13429: Lorg/apache/log4j/Level;.toLevel (I)Lorg/apache/log4j/Level; > 11-04 16:15:06.564: WARN/dalvikvm(367): VFY: unable to resolve static > method 13429: Lorg/apache/log4j/Level;.toLevel (I)Lorg/apache/log4j/Level; > 11-04 16:15:06.564: WARN/dalvikvm(367): VFY: unable to resolve static > method 11555: Lcom/google/gwt/core/client/GWT;.isClient ()Z > 11-04 16:15:06.593: WARN/dalvikvm(367): VFY: unable to resolve static > method 11555: Lcom/google/gwt/core/client/GWT;.isClient ()Z > 11-04 16:15:06.593: WARN/dalvikvm(367): Exception > Ljava/lang/NoClassDefFoundError; thrown during > Lcom/allen_sauer/gwt/log/shared/LogRecord;.<clinit> > 11-04 16:15:06.614: WARN/dalvikvm(367): threadid=10: thread exiting with > uncaught exception (group=0x4001d800) > 11-04 16:15:06.614: ERROR/ACRA(367): ACRA caught a RuntimeException > exception for com.fizzbuzz.newsbot.android. Building report. > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): FATAL EXCEPTION: AsyncTask > #3 > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): java.lang.RuntimeException: > An error occured while executing doInBackground() > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > android.os.AsyncTask$3.done(AsyncTask.java:200) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.FutureTask.setException(FutureTask.java:124) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.FutureTask.run(FutureTask.java:137) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.lang.Thread.run(Thread.java:1096) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): Caused by: > java.lang.ExceptionInInitializerError > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.allen_sauer.gwt.log.client.Log.debug(Log.java:107) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.allen_sauer.gwt.log.client.Log.debug(Log.java:111) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.allen_sauer.gwt.log.client.Log.debug(Log.java:91) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.model.NewsFeed.compareTo(NewsFeed.java:149) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.model.Utils.FilterChanges(Utils.java:18) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.android.persist.NewsFeedPersist.processChanges(NewsFeedPersist.java:140) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.android.persist.PersistManager.processNewsDataChanges(PersistManager.java:118) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.android.persist.PersistManager.access$2(PersistManager.java:116) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.android.persist.PersistManager$3.doJob(PersistManager.java:131) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.newsbot.android.persist.PersistManager$3.doJob(PersistManager.java:1) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.android.util.AsyncTaskHelper.doInBackground(AsyncTaskHelper.java:148) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.fizzbuzz.android.util.AsyncTaskHelper.doInBackground(AsyncTaskHelper.java:1) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > android.os.AsyncTask$2.call(AsyncTask.java:185) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): ... 4 more > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): Caused by: > java.lang.NoClassDefFoundError: com.google.gwt.core.client.GWT > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): at > com.allen_sauer.gwt.log.shared.LogRecord.<clinit>(LogRecord.java:34) > 11-04 16:15:09.937: ERROR/AndroidRuntime(367): ... 18 more > > -- > You received this message because you are subscribed to the Google Groups > "gwt-log" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/gwt-log/-/zNawVvIwSvAJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/gwt-log?hl=en. > -- Fred Sauer [email protected] -- You received this message because you are subscribed to the Google Groups "gwt-log" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/gwt-log?hl=en.
