Gaurav Sachdeva
Gaurav Sachdeva

Reputation: 672

ANT Script Build Messages into a log4j configured log file

I am developing a java project using Eclipse as IDE and ant as the build tool. For logging I am making use of log4j library. I am able to get the log messages in a log file for my whole application using log4j configuration. But when I build project using ANT, the ANT build messages are still posted to console.I want to make sure that when I build the project, the build messages that ANT generates, like build failure/success, should also be posted to that sames logger file using log4j.

Please help me in this if anyone has got an idea. Thanks

Upvotes: 0

Views: 613

Answers (1)

David W.
David W.

Reputation: 107040

To pass the logging log4j, you can use this when you run Ant:

$ ant -listener org.apache.tools.ant.listener.Log4jListener

The configuration of log4j is then up to you. See the information on Listeners in the Ant manual.

Upvotes: 1

Related Questions