In my opinion, it's not an issue of verbosity. It's whether a
framework such as Castor such mandate the use of a logging framework.
In my view, it should not.
I ran my Castor application with -verbose to track the dependency. It
appears that the dependency is due to a static initializer in
org.exolab.castor.util.Configuration. There, you do:
private static final Log LOG = LogFactory.getLog(Configuration.class);
This places the call to "LogFactory.getLog())" in the static
initializer of the Configuration class.
This means that any application that creates a reference to your
"Configuration" class will trigger this call. A better way would be to
move this into the static initializer of another class that is only
loaded if logging is actually used. (Recall that Java's class loading
mechanism mandates that class initializers are only invoked if there's
an active use of a class.)
It would remove a major annoyance when using Castor, and it would make
no difference to users who need or want to use logging with Castor.
- Godmar
On 11/6/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> That might be your view, but there's quiet some users out there
> apprecaite some verbosity even from (tool) frameworks such as Castor is.
>
> Regards
> Werner
>
> Godmar Back wrote:
> > Replace log4j with commons-logging - my argument still holds:
> >
> > Why does Castor need to do *any* logging, commons or otherwise? It's a
> > library, there's no need for it to *depend* on any logging facilities.
> > [ In fact, what *would* it log? I would not like it if a library
> > wrote to *my* log without my instructing it. ]
> >
> > - Godmar
> >
> > On 11/6/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> >> Sorry, but Castor does *not* introduce any dependencies for log4j, as
> >> any code related to logging is coded through Jakarta's commons-logging
> >> package.
> >>
> >> Having said that, I think that we ship the log4j JAR by default as part
> >> of the source code (through the SVN repo). As such, commons-logging will
> >> acknowledge its existence on the classpath and enable it - resulting
> >> into the message given by you below.
> >>
> >> Regards
> >> Werner
> >>
> >> Godmar Back wrote:
> >>> Related: whenever I run a castor program, I get:
> >>>
> >>> log4j:WARN No appenders could be found for logger
> >>> (org.exolab.castor.xml.Unmarshaller).
> >>> log4j:WARN Please initialize the log4j system properly.
> >>>
> >>> I'm not using log4j, it's a dependency that Castor introduces. I once
> >>> tried to figure out what log4j is, and how to "initialize it
> >>> properly", but found that the only documentation exists in a for-sale
> >>> book by the author.
> >>>
> >>> It would be nice if Castor suppressed this message and only
> >>> initialized logging facilities if they are in fact used. (I don't use
> >>> them, and so neither should Castor when used as a library.)
> >>>
> >>> - Godmar
> >>>
> >>> On 11/5/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> >>>> No document, as it's standard logging and depends on what tool you are
> >>>> using for logging. Are you by chance using log4j ?
> >>>>
> >>>> Werner
> >>>>
> >>>> Jayaraman, Kannan wrote:
> >>>>> Thanks for the response. Can you pls, point me a URL/Doc link in
> >>>>> Castor, where I could refer about how to turn on the logging for Castor
> >>>>> XML/Java binding code generator.
> >>>>>
> >>>>> Thanks
> >>>>> Kannan
> >>>>>
> >>>>> -----Original Message-----
> >>>>> From: Werner Guttmann [mailto:[EMAIL PROTECTED]
> >>>>> Sent: Sunday, November 04, 2007 11:07 AM
> >>>>> To: [email protected]
> >>>>> Subject: Re: [castor-user] Castor Logging and XML validation
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> please see inline.
> >>>>>
> >>>>> Werner
> >>>>>
> >>>>> Jayaraman, Kannan wrote:
> >>>>>> How do I enable logging while using castor binding files (to log the
> >>>>>> output, while I generate the castor binding classes).
> >>>>> I assume you are referring to the Castor XML code generator, which is
> >>>>> used to generate Java classes from an XML schema ? If so, this code (as
> >>>>> well as other parts of Castor) use Jakarta's commons-logging package for
> >>>>> logging. As such, you can plug in any logging provider of your choice,
> >>>>> such as Log4J or simply Java logging.
> >>>>>
> >>>>>> Also, is the XSD validation while unmarshalling/marshalling of
> >>>>>> XML-to-Java using Castor binding frameworks, is automatically enabled.
> >>>>> No, it is not.
> >>>>>
> >>>>>> Or is there a place to turn on/off ?
> >>>>> Please have a look at the documentation of the Castor properties file.
> >>>>>
> >>>>>> Pls help
> >>>>>> Thanks
> >>>>>> Kannan
> >>>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: kirran [mailto:[EMAIL PROTECTED]
> >>>>>> Sent: Thursday, November 01, 2007 4:30 PM
> >>>>>> To: [email protected]
> >>>>>> Subject: [castor-user] castor user issue
> >>>>>>
> >>>>>>
> >>>>>> Hi All,
> >>>>>>
> >>>>>> Any help is sincerely appreciated.
> >>>>>>
> >>>>>> sample xml
> >>>>>> ---
> >>>>>> <person name="tom"/>
> >>>>>> <person name="brady"/>
> >>>>>>
> >>>>>>
> >>>>>> class Person{
> >>>>>> private name;
> >>>>>> public void setName(String name){
> >>>>>> this.name=name;
> >>>>>> }
> >>>>>> }
> >>>>>>
> >>>>>> When i use castor, it gives me a collection of person objects. What i
> >>>>>> need is a callback in my client code after each person
> >>>>>>
> >>>>>> element is parsed into an object sequentially so that i can invoke
> >>>>>> operations on each object. This is also inline with my req.
> >>>>>>
> >>>>>> of not storing an entire collection of persons in memory at once.
> >>>>>>
> >>>>>> Thanks in advance.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> View this message in context:
> >>>>>> http://www.nabble.com/castor-user-issue-tf4734226.html#a13537918
> >>>>>> Sent from the Castor - User mailing list archive at Nabble.com.
> >>>>>>
> >>>>>>
> >>>>>> ---------------------------------------------------------------------
> >>>>>> To unsubscribe from this list please visit:
> >>>>>>
> >>>>>> http://xircles.codehaus.org/manage_email
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> ---------------------------------------------------------------------
> >>>>>> To unsubscribe from this list please visit:
> >>>>>>
> >>>>>> http://xircles.codehaus.org/manage_email
> >>>>>>
> >>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe from this list please visit:
> >>>>>
> >>>>> http://xircles.codehaus.org/manage_email
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe from this list please visit:
> >>>>>
> >>>>> http://xircles.codehaus.org/manage_email
> >>>>>
> >>>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe from this list please visit:
> >>>>
> >>>> http://xircles.codehaus.org/manage_email
> >>>>
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe from this list please visit:
> >>>
> >>> http://xircles.codehaus.org/manage_email
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list please visit:
> >>
> >> http://xircles.codehaus.org/manage_email
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email