Andy et alias,

I wish there'd be a short and precise answer, but there ain't .. ;-).
Having said that, let me try to explain the current situation in detail.

Castor is a product that has grown to where we are over more than 8 (9)
years, with a lot of people contributing to this outstanding product in
one way or the other. As such, it is only natural to have a code base
that is somehow inconsistent in some areas, and logging definitely is
one of those areas. Okay, where to start ?

Castor JDO, for example, uses Jakarta's commons-logging exclusively, and
as such it should be easy (if not straight-forward) to use Log4J with
Castor JDO. Just put your custom log4j.properties or log4j.xml onto the
classpath ... and you've got a full integration with Log4J.

With Castor XML, we have *started* to migrate to commons-logging as
well, as any new class (or any class refactored) will be injected a Log
instance. But there's many classes in Castor XML (and the code
generator, that is), that use a 'home-grown' approach for logging, where
there's a property in castor.properties to turn this on and off. In
other words, turning this property on will instruct Castor XML to write
logging information to System.out. There's an option to set a
PrintWriter instance on e.g. the Unmarshaller using
setLogWriter(PrintWriter), but this is nowhere near the functionality or
granularity that fully-grown frameworks like Log4J  and/or
common-logging offer.

I hope this partly addressed your questions, and I can reassure you that
 - with a little help from the community - we will one day migrate to
commons-logging fully.

Regards
Werner


Andy Buckley wrote:
> Andy Buckley wrote:
>> giljo scaria wrote:
>>> Hi ,
>>>
>>> I am using castor-1.0.5-xml  for marshalling Java
>>> objects to xml files.Log4j is used for logging the
>>> messages  in  my application,but castor seems to have
>>> its own logging mechanism and it spits out INFO
>>> messages to console.
>>>
>>> Is there anyway to make castor_xml to use the log4j
>>> already configured for the application.
>>>
>>> Or else is there any way to change the level of log
>>> messages to ERROR or WARN in castor.
>> I would also be interested to know about this. My current understanding
>> of the situation is that Castor uses log4j but actually writes the
>> log4j.properties file into the published JAR, so it can't be overridden.
>>
>> If that's right, it would be nice(r) if Castor only used a
>> log4j.properties file in src/test/resources, so that Maven would use it
>> for Castor build tests but not force any log4j config in the final JAR.
>> Does that make sense, or am I talking rubbish? ;-)
> 
> Actually, looking at the current Castor SVN trunk, it looks like the
> log4j config doesn't exist in src/main after all:
> 
> [EMAIL PROTECTED]:.../proj/castor$ find . -name "log4j.*" | grep -v \.svn
> ./src/test/resources/log4j.xml
> ./src/bugs/log4j.xml
> ./src/etc/log4j.xml
> ./src/examples/log4j.xml
> ./target/test-classes/log4j.xml
> ./ddlgen/src/test/resources/log4j.xml
> 
> Sorry for the confusion! I'd still also be interested in knowing how to
> control the Castor log level...
> 
> Andy
> 
> ---------------------------------------------------------------------
> 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

Reply via email to