Package org.apache.tools.ant.listener
Class CommonsLoggingListener
- java.lang.Object
- 
- org.apache.tools.ant.listener.CommonsLoggingListener
 
- 
- All Implemented Interfaces:
- java.util.EventListener,- BuildListener,- BuildLogger
 
 public class CommonsLoggingListener extends java.lang.Object implements BuildListener, BuildLogger Jakarta Commons Logging listener. Note: do not use the SimpleLog as your logger implementation as it causes an infinite loop since it writes to System.err, which Ant traps and reroutes to the logger/listener layer. The following names are used for the log: org.apache.tools.ant.Project.PROJECT_NAME - for project events org.apache.tools.ant.Target.TARGET_NAME - for target events TASK_CLASS_NAME.TARGET_NAME - for events in individual targets. In all target and project names we replace "." and " " with "-". TODO: we should use the advanced context logging features (and expose them in c-l first :-) TODO: this is _very_ inefficient. Switching the out and tracking the logs can be optimized a lot - but may require few more changes to the core.- Since:
- Ant 1.5
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringPROJECT_LOGname of the category under which project events are loggedstatic java.lang.StringTARGET_LOGname of the category under which target events are logged
 - 
Constructor SummaryConstructors Constructor Description CommonsLoggingListener()Construct the listener and make sure that a LogFactory can be obtained.
 - 
Method SummaryModifier and Type Method Description voidbuildFinished(BuildEvent event)Signals that the last target has finished.voidbuildStarted(BuildEvent event)Signals that a build has started.voidmessageLogged(BuildEvent event)Signals a message logging event.voidsetEmacsMode(boolean emacsMode)Set emacs mode.voidsetErrorPrintStream(java.io.PrintStream err)Set the error print stream.voidsetMessageOutputLevel(int level)Set the the output level.voidsetOutputPrintStream(java.io.PrintStream output)Set the output print stream.voidtargetFinished(BuildEvent event)Signals that a target has finished.voidtargetStarted(BuildEvent event)Signals that a target is starting.voidtaskFinished(BuildEvent event)Signals that a task has finished.voidtaskStarted(BuildEvent event)Signals that a task is starting.
 
- 
- 
- 
Field Detail- 
TARGET_LOGpublic static final java.lang.String TARGET_LOG name of the category under which target events are logged- See Also:
- Constant Field Values
 
 - 
PROJECT_LOGpublic static final java.lang.String PROJECT_LOG name of the category under which project events are logged- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
buildStartedpublic void buildStarted(BuildEvent event) Signals that a build has started. This event is fired before any targets have started.This event is fired before the project instance is fully configured. In particular no properties have been set and the project may not know its name or default target, yet. .- Specified by:
- buildStartedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
 
 - 
buildFinishedpublic void buildFinished(BuildEvent event) Signals that the last target has finished. This event will still be fired if an error occurred during the build..- Specified by:
- buildFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- BuildEvent.getException()
 
 - 
targetStartedpublic void targetStarted(BuildEvent event) Description copied from interface:BuildListenerSignals that a target is starting.- Specified by:
- targetStartedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- .
 
 - 
targetFinishedpublic void targetFinished(BuildEvent event) Description copied from interface:BuildListenerSignals that a target has finished. This event will still be fired if an error occurred during the build.- Specified by:
- targetFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- .
 
 - 
taskStartedpublic void taskStarted(BuildEvent event) Description copied from interface:BuildListenerSignals that a task is starting.- Specified by:
- taskStartedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- .
 
 - 
taskFinishedpublic void taskFinished(BuildEvent event) Description copied from interface:BuildListenerSignals that a task has finished. This event will still be fired if an error occurred during the build.- Specified by:
- taskFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- .
 
 - 
messageLoggedpublic void messageLogged(BuildEvent event) Description copied from interface:BuildListenerSignals a message logging event.- Specified by:
- messageLoggedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Must not be- null.
- See Also:
- .
 
 - 
setMessageOutputLevelpublic void setMessageOutputLevel(int level) Set the the output level. This is not used, the logger config is used instead.- Specified by:
- setMessageOutputLevelin interface- BuildLogger
- Parameters:
- level- ignored
 
 - 
setOutputPrintStreampublic void setOutputPrintStream(java.io.PrintStream output) Set the output print stream.- Specified by:
- setOutputPrintStreamin interface- BuildLogger
- Parameters:
- output- the output stream
 
 - 
setEmacsModepublic void setEmacsMode(boolean emacsMode) Set emacs mode. This is ignored.- Specified by:
- setEmacsModein interface- BuildLogger
- Parameters:
- emacsMode- ignored
 
 - 
setErrorPrintStreampublic void setErrorPrintStream(java.io.PrintStream err) Set the error print stream.- Specified by:
- setErrorPrintStreamin interface- BuildLogger
- Parameters:
- err- the error stream
 
 
- 
 
-