Saturday, February 26, 2011

Re: is it possible to use an SLF4J adapter in GWT to wrap java.util.logging ?

To respond to the question....
May I ask why do you need something like that? Basically everything
what you need is inside of gwt-user package.

I did it before the GWT project had java.util.Logging and
some people do NOT like the java.util.Logging package,
I see a lot more people using log4j (as it was the original logging
library in java).

It gives your project developers options of which logging
implementation they want to use.

For instance I develop a widget A, and it is used by two projects one
uses log4j the other uses java.util.logging.
If I use java.util.logging in my widget A, then the project that uses
log4j will need to configure logging twice,
which is a pain in the butt.
Also vice versa.

If my widget uses i_log, you can simply delegate the i_log message
calls to log4j or java.util.logging
so you only have one common logging config file to configure your
logging implementation.

Also for some code I can write it so that it will work on JSE, JME and
GWT so I can keep some core logic shared rather than written more than
once (and maintained more than once).

Cheers,
Scott

On Feb 26, 11:54 am, Adligo <sc...@adligo.com> wrote:
> Why didn't you use i_log, as I already finished it and open sourced it
> several years ago?
>
> http://cvs.adligo.org/viewvc/i_log/
> common logging api anywhere you could use a .java source file.
> JSE, JME and GWT
>
> Cheers,
> Scott
>
> On Feb 25, 5:50 am, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>
>
> > On Friday, February 25, 2011 4:04:12 AM UTC+1, zixzigma wrote:
>
> > > is it possible to use an SL4J adapter in GWT to wrap java.util.logging ?
>
> > I started working on something like that at work, and we will eventually
> > open source it.
>
> > For now, I can use Slf4J in my client code. In DevMode, it will use whatever
> > Slf4j implementation it finds in the classpath (which means that it will
> > write to the console, not to the DevMode window), and it compiles out in
> > prod mode.
> > I've been thinking recently about just wrapping java.util.logging (and using
> > jul-to-slf4j.jar to format my logs using logback) instead of my default,
> > emulated NOPLoggerFactory (used in web mode only), but we actually don't use
> > it that much in client code (and overall), so I didn't invest any more time
> > in it for now.
>
> > There's also a project on GitHub:https://github.com/derjan1982/slf4gwtmore
> > like gwt-log than JUL integration in GWT though, IIRC.
>
> > > I would like to be able to use logging.properties file to define
> > > formatting,
> > > which I believe is not possible with java.util.logging.
>
> > I believe you can (at least in DevMode I mean, or when using a
> > RemoteLogHandler), though you might have to make your own Formatter class
> > (or pick a third-party one).

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment