Sample log4j or file

Hi all,


Im using Liquibase via ANT tasks in a production environment and need to log the output of the console logging to a file also, as when clients install DB, we need to record output and sometimes trouble shoot.


I have added the liquibase-jul-1.0.jar to my ANT classpath, but I dont know how to configure the logger with a properties file? And where this file goes? Do I also have to pass in an ANT system property so that ANT picks up the file?


Im open to using either log4j or java logging, so any complete example is appreciated. I dont see any posted on forums or the extensions portal.


Thanks a lot for the effort on this great product,




P.s im also interestd in logging the SQL to a file too… Is P6SPY the best practice mechanism for this?



I’m not entirely sure how to help you here; as the link mentions, java.util.logging construct, not a Liquibase construct, and not anything that my logging extension looks for explicitly.  Java’s logging configuration affects the JVM as a whole, regardless of what tool you might happen to be running.

I would invest your time in reading the link I mentioned to understand how Java logging works.  It will help you in other projects as well.


For java.util.logging, here is the guide on all things related to how it works:

In case you are using Glassfish, you’ll find the file in $GLASSFISH_HOME/domains/domain1/config/




Thanks for the reply, so I am persuming that once I have a file, I only need to have the Liquibase Juli extension on my classpath and the file (say in same directory as build.xml) for Liquibase to pick it up?


I suppose Im not clear on how Liqubase finds this file, without me explicitly passing it a location via Ant, command line or otherwise… and in my environment, im running liquibase standalone via ANT tasks…



Im posting my solution, I decided to use a Log4J ANT listener to pipe the console output of ANT to a file.


My ANT command is something like this… (log4j stuff is in relative folder “tools” - and added to classpath via -lib)


ant -listener -lib tools. create-daffy-database-objects-from-changeover


log4j.proeprties file contents… 


log4j.rootLogger=INFO, LogFile

log4j.appender.LogFile.layout.ConversionPattern=[%6r] %8c{1} : %m%n


Thanks Laird for you responses, however my original question, I beleive - was not connected to Log4J or Java logging, I already am familar with these tools - its specifically targeted at other peoples experiences of how to use Ant and Liquibase (with Logging extensions). I was hoping someone could share what they did so I could cross reference.


Simply, in my case Liquibase was not picking up my logging configuration. I was not sure why, perhaps because the ANT process was spawning a new JVM instance when starting liquibase, which did not inherit the original classpath? (guessing here?) …  anyhow, I think some documentation on how people set up this kind of logging would be useful to end-users.


Many Thanks.