Friday, February 11, 2011

What logging can be used to log in GWT shared code?

There are three types of code in a GWT project:

  1. Client code (GWT client / javascript)
  2. Server code (servlet container / java)
  3. Shared code (GWT client & servlet container / javascript & java)

Logging framework usable for each type:

  1. Client - gwt-log
  2. Server - slf4j
  3. Shared - ???

I'd like to have a write once for the shared code that could include logging.

Any solutions out there for this?

  • GWT 2.1 includes java.util.logging emulation, you can find a sample project using it. You should be able to use this in shared code that's running on the client side and server side.

    TJ : JUL -> SLF4J bridge is not very efficient. http://www.slf4j.org/legacy.html#jul-to-slf4j So I'd prefer not to use it.
    Arthur Kalmenson : Yeah, JUL isn't the nicest solution out there, but that's what the GWT team is emulating in GWT 2.1. For something to log on both sides, I don't think you have many options. What code exactly are you going to be using this logging in? Usually the shared code is just domain objects (or DTOs).
    TJ : @Arthur JUL it may have to be... I haven't fully explored the use-case that my team needs for logging in the shared code. It's possible shared code doesn't _really_ need to log.
    TJ : Here is the feature request: http://code.google.com/p/google-web-toolkit/issues/detail?id=4954 Also, Logback had a new feature that will help with performance: http://logback.qos.ch/manual/configuration.html#LevelChangePropagator

0 comments:

Post a Comment