Remote Logging

425 views
Skip to first unread message

Keith Bennett

unread,
Dec 20, 2011, 10:58:09 AM12/20/11
to Google Web Toolkit
I have Remote Logging enabled, and any data logged in my GWT client
code only shows up in my Tomcat console. I have logback configured
and correctly logging data to log files for server code. Does anyone
know how I can configure GWT remote logging so that my client log data
gets directed to my logback files on the server?

Thomas Broyer

unread,
Dec 20, 2011, 5:03:41 PM12/20/11
to google-we...@googlegroups.com
GWT only uses java.util.logging, so you have to configure the Slf4j bridge to redirect the logs to logback.

Keith Bennett

unread,
Dec 21, 2011, 1:43:00 PM12/21/11
to Google Web Toolkit
Thomas, thanks for the feedback. I included the log4j-over-slf4j, jcl-
over-slf4j, and jul-to-slf4j jars in my project, but I still do not
see anything logged in my logback files. When you stated that I
needed to configure the slf4j bridge, do you know if there is anything
else I need to do (other than include the jul-to-slf4j jar)? By the
way, I was able to implement my own versions of the GWT
RemoteLoggingServiceImpl and RemoteLoggingServiceUtil classes that use
the slf4j Logger and LogFactory classes, and with this implementation
I am able to direct log output to the logback files. I do not want to
have to maintain my own version of these classes, so I am really
wanting to get the slf4j bridge configured correctly. Thanks for any
advice you have!

Ed

unread,
Dec 21, 2011, 2:41:17 PM12/21/11
to google-we...@googlegroups.com

Keith Bennett

unread,
Dec 21, 2011, 2:54:58 PM12/21/11
to Google Web Toolkit
Ed, I have followed all of the guidelines as documented in the first
link you sent. Again, I am able to direct the log output to my
logback-managed files, but only if I use the RemoteLoggingServiceImpl
and RemoteLoggingServiceUtil custom classes I created that use the
slf4j Logger and LogFactory classes. I know that these classes use
java.util.logging as Thomas first mentioned. If I can get the slf4j
bridge configured, I am assuming that I can use the GWT versions of
these classes instead of mine. All I'm trying to figure out now is
how to properly configure the slf4j bridge as Thomas indicated I
should do. I have referenced instructions listed at http://www.slf4j.org/legacy.html.
Is there anything more I need to do other than including the jul-to-
slf4j jar as a dependency?
> <http://code.google.com/p/gwt-log/>

Ed Bras

unread,
Dec 21, 2011, 3:12:27 PM12/21/11
to google-we...@googlegroups.com
Make sure you correctly install the jul bridge: SLF4JBridgeHandler.install() when your app starts.
See: http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html

If that doesn't work, then debug it, and you will quickly find out what goes wrong.




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Keith Bennett

unread,
Dec 22, 2011, 12:44:54 PM12/22/11
to Google Web Toolkit
Ed, thanks for your reply! The log data is now being directed to my
logback files on the server, but I still have one remaining issue. I
noticed that all of the java.util.logging get additionally logged to
my Tomcat console. Any native logback logging statements do not. So,
with the introduction of the SLF4JBrideHandler.install() method, do
you know of a way to suppress the java.util.logging output on the
Tomcat console yet still allow it to be directed to the logback files?

On Dec 21, 2:12 pm, Ed Bras <post2edb...@gmail.com> wrote:
> Make sure you correctly install the jul bridge: SLF4JBridgeHandler.install()
> when your app starts.
> See:http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html
>
> If that doesn't work, then debug it, and you will quickly find out what
> goes wrong.
>
> On Wed, Dec 21, 2011 at 8:54 PM, Keith Bennett
> <keith.benn...@forthwind.com>wrote:

Ed Bras

unread,
Dec 22, 2011, 2:10:24 PM12/22/11
to google-we...@googlegroups.com

Keith Bennett

unread,
Dec 22, 2011, 5:08:03 PM12/22/11
to Google Web Toolkit
Ed,

Thank you for the link. I tried searching for a solution myself, but
I guess I didn't enter the correct search terms. Regardless, after
tinkering with several of the solutions offered via the link you sent
me, the following solution worked for me:

Logger globalLogger = Logger.getLogger("");
Handler[] handlers = globalLogger.getHandlers();
for(Handler handler : handlers) {
globalLogger.removeHandler(handler);
}
SLF4JBridgeHandler.install();

Thank you very much for your help!

On Dec 22, 1:10 pm, Ed Bras <post2edb...@gmail.com> wrote:
> Google is your friend:http://stackoverflow.com/questions/2533227/how-can-i-disable-the-defa...
> <http://stackoverflow.com/questions/2533227/how-can-i-disable-the-defa...>
>
> On Thu, Dec 22, 2011 at 6:44 PM, Keith Bennett
> <keith.benn...@forthwind.com>wrote:
Reply all
Reply to author
Forward
0 new messages