ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tek1 <>
Subject Re: displaying project name before target name in output
Date Fri, 10 Jan 2003 19:12:02 GMT
thank you for your reply erik.

it looks fairly straight-forward to create a new logger class (i.e. 
"NewLogger") that extends DefaultLogger and overrides the 
targetStarted(BuildEvent event) method as follows:

     public void targetStarted(BuildEvent event) {
         if (Project.MSG_INFO <= msgOutputLevel) {
             String msg = StringUtils.LINE_SEP
                 + event.getProject().getName() + "."
                 + event.getTarget().getName() + ":";
             printMessage(msg, out, event.getPriority());

when i want to use this new logging class, then am i correct to assume that 
upon each ant execution, i need to specify it as follows?

         > ant -logger NewLogger <target>

if so, is there a way to specify the logger to be used in something like an file, such that ant can be executed as normal, without 
explicity specifying "-logger NewLogger" each time?  if not, no problem.

out of curiosity, have any other people requested the ability to change the 
target name lines (i.e. "init: ")?  if so, then a suggestion for a future 
feature is to adopt a junit-style syntax (i.e. "%P.%T" which would print 
<projectName>.<targetName>; and other %... options) and specify these in a file or something?  just an idea.

thanks again for the great advice to solving my problem!

At 13:03 03/01/10 -0500, you wrote:
>You could write a custom BuildLogger implementation that would do this, no 
>problem.  Would be fairly easy.  Have a look at the DefaultLogger built 
>into Ant for inspiration.
>         Erik

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message