ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <>
Subject RE: two listeners but only different logging
Date Fri, 22 Oct 2010 13:10:43 GMT

AntPerformanceListener handles log events for ANT events here are the impelemented methods

public class net.sf.antcontrib.perf.AntPerformanceListener extends java.lang.Obj
ect implements{
    public net.sf.antcontrib.perf.AntPerformanceListener();
    public void buildStarted(;
    public void buildFinished(;
    public void targetStarted(;
    public void targetFinished(;
    public void taskStarted(;
    public void taskFinished(;
    public void messageLogged(;
    public static void main(java.lang.String[]);

but the stdout Log appenders you will be sending to are not configurable appenders 
if you desire to send the output to anywhere else other than stdout you would need to implement
Log4jListener here is the JavaDoc

Passes build events to Log4j, using the full classname's of the 
generator of
each build event as the category:
build started / build finished - started / target finished
- started / task finished - the fully qualified classname
the taskmessage logged - the classname of one of the above, so if a task 
logs a
  message, its classname is the category used, and so on.
All start events are logged as INFO.  Finish events are either logged
INFO or ERROR depending on whether the build failed during that stage. 
events are logged according to their Ant logging level, mapping directly
 to a
corresponding Log4j level.

ant -listener

To use Log4j you will need the Log4j JAR file and a 
configuration file.  Both should be placed somewhere in your Ant
classpath. If the is in your project root folder you 
add this with -lib option:

ant -listener -lib .

If, for example, you wanted to capture the same information output to
console by the DefaultLogger and send it to a file named 'build.log', 
could use the following configuration:

log4j.rootLogger=ERROR, LogFile

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

Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.

> Date: Fri, 22 Oct 2010 04:36:07 -0700
> From:
> To:
> Subject: two listeners but only different logging
> Hi,
> I am using two listeners : 
> net.sf.antcontrib.perf.AntPerformanceListener
> I want all print statements other than 'performance statistics' to be
> printed on the console. so that means i cannot use the -logFile option.
> How can we implement this differentiated behaviour of listeners in ant? 
> -- 
> View this message in context:
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message