db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: Configuring log4j for Ant when running DDLUtils tasks
Date Wed, 14 Jun 2006 22:44:11 GMT
On 6/14/06, Guy Davis <davis@guydavis.ca> wrote:

> I was hoping that someone would have an idea as to how I can configure
> the log4j system so that DDLUtils log messages are output to the console
> when running Ant tasks.
>
> For example, here's the main portion of an Ant task labelled db.clean:
>
> <ddl_to_db schemaFile="${ddlutils.dir}/empty_schema.xml"
> databaseType="${db.type}" validateXml="false">
>    <database url="${db.url}" driverClassName="${db.driver}"
> username="${db.user}" password="${db.password}" />
>    <writeSchemaToDatabase alterDatabase="true" />
> </ddl_to_db>
>
> Here's the command line output:
> $ ant -Ddb.props=database/ddlutils/oracle.properties db.clean
>
> [ddl_to_db] log4j:WARN No appenders could be found for logger
> org.apache.commons.digester.Digester).
> [ddl_to_db] log4j:WARN Please initialize the log4j system properly.
>
> This is important as it would give us clues as to why the Ant tasks fail
> for situtations like all the Oracle tablespace is used up etc...

Well, Ant is difficult when it comes to logging because a task is
usually loaded from a classloader that is different to Ant's own
classloader. Thus, it is required to put the logging configuration
file (e.g. log4j.properties) into the classpath that is used to
load/run the task.
When defining the task you should have a classpathref attribute or a
classpath subelement that specifies the ddlutils jar among others. In
this classpath you need to include the logging properties file, e.g.
by adding an additional path entry to this classpath.

Tom

Mime
View raw message