You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Simon Kitching <si...@chello.at> on 2007/12/15 20:26:18 UTC

logging

Hi Mario,

You mean a myfaces-commons-logging module, that the following depend on?
 * myfaces-commons-*
 * myfaces-core
 * myfaces-trinidad

The problem again is that each of those has its own resource bundle for its messages, and that there would need to be some mechanism for it to inform the myfaces-commons-logging module about them.

(plus, it's ugly to add dependencies like this).

It seems that it might be easier to provide patches to slf4j to register resource bundles for specific category strings, eg

  org.slf4j.LoggerFactory.registerResource(
    String category, 
    String bundleName);

But then the question is how such a call would be triggered. Maybe a
static block on an important class in every library could be used to
trigger that..seems sane at first thought, although logging is so
surprisingly tricky I am hesitant to say that any new feature is
actually possible.

Not sure how the SLF4J project would see that kind of patch. I'll ask
though..

The same kind of functionality could be added to commons-logging too I guess. But I had hoped commons-logging was at the end of its development life..

Regards,

Simon

On Sat, 2007-12-15 at 20:07 +0100, Mario Ivankovits wrote:
> this sounds like yet another complexity.
> 
> I18n can be solved by a custom app layer even easier, no?
> 
> So this would mean we should go your custom myfaces logger wrapper. I would not complain if commons depend on it, I think.
> 
> 
> Mario
> 
> -----Original Message-----
> From: simon <si...@chello.at>
> Date: Saturday, Dez 15, 2007 8:00 pm
> Subject: Re: [commons] What Logger ?
> To: Reply-    "MyFaces Development" <de...@myfaces.apache.org>To: MyFaces Development <de...@myfaces.apache.org>
> 
> The issue is that Trinidad (ADF faces) has always emitted
> >internationalised log messages, by using its own logging implementation.
> >
> >But commons-logging does not offer any help for that. If code wants to emit a log message that can be internationalised, it looks like this:
> >
> > if (log.isDebugEnabled()) {
> >    String msg = TrinidadMsgFormatter.format("SomeMsgKey", arg1, arg2);
> >    log.debug(msg);
> > }
> >
> >This is certainly inconvenient.
> >
> >The slf4j equivalent looks like this:
> >  log.debug("SomeMsgKey", arg1, arg2);
> >which at initial glance seems nicer.
> >
> >However there are a number of gotchas. The most important is how the resources are found to map (key, args) to a sensible message.
> >
> >If the underlying logging implementation is i18n-aware then SLF4j jus tpasses the data on. But the underlying impl still needs to somehow know how to find the Trinidad resource bundles in order to create sensible logging messages. I don't have any experience with i18n-aware logging systems, so I'll leave that to others to comment on how easy/difficult it is to arrange that.
> >
> >But AFAIK if the underlying logging implementation is *not* i18n-aware, then the message written to the log will simply be "SomeMsgKey", with all info about the actual params lost. This, for example, is the default SLF4J behaviour when configured to forward messages to commons-logging or log4j.
> >
> >Regards,
> >
> >Simon
> >
> >On Sat, 2007-12-15 at 18:32 +0000, Bruno Aranda wrote:
> > And sorry, I do not know sl4j, what do we gain with it? Thanks!
> > 
> > Bruno
> > 
> > On 15 Dec 2007 19:26:00 +0100, Mario Ivankovits <ma...@ops.co.at> wrote:
> > > could you explain what we gain from that switch?
> > >
> > > I just see one additional jar as the user has to deal with cl anyway.
> > >
> > > It is the defacto standard.
> > >
> > > Did you consider the java std log facility. Might be as good as sl4j.
> > > A cl adapter might be doable there too.
> > >
> > >
> > >
> > > Mario
> > >
> > > -----Original Message-----
> > > From: "Matthias Wessendorf" <ma...@apache.org>
> > > Date: Saturday, Dez 15, 2007 7:12 pm
> > > Subject: Re: [commons] What Logger ?
> > > To: "MyFaces Development" <de...@myfaces.apache.org>, mario@ops.co.at
> > >
> > > I think, that Manfredo will also put it into myfaces-core
> > > >:-)
> > > >
> > > >Simon suggested to create a MyFaces Logger,
> > > >but... commons should not depend on that.
> > > >
> > > >(a cool discussion on the hackaton)
> > > >
> > > >-M
> > > >
> > > >On 15 Dec 2007 19:01:00 +0100, Mario Ivankovit
>