Package org.apache.tools.ant
Class XmlLogger
java.lang.Object
org.apache.tools.ant.XmlLogger
- All Implemented Interfaces:
- EventListener,- BuildListener,- BuildLogger
Generates a file in the current directory with
 an XML description of what happened during a build.
 The default filename is "log.xml", but this can be overridden
 with the property 
XmlLogger.file.
 This implementation assumes in its sanity checking that only one
 thread runs a particular target/task at a time. This is enforced
 by the way that parallel builds and antcalls are done - and
 indeed all but the simplest of tasks could run into problems
 if executed in parallel.- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbuildFinished(BuildEvent event) Fired when the build finishes, this adds the time taken and any error stacktrace to the build element and writes the document to disk.voidbuildStarted(BuildEvent event) Fired when the build starts, this builds the top-level element for the document and remembers the time of the start of the build.intvoidmessageLogged(BuildEvent event) Fired when a message is logged, this adds a message element to the most appropriate parent element (task, target or build) and records the priority and text of the message.voidsetEmacsMode(boolean emacsMode) Ignore emacs mode, as it has no meaning in XML formatvoidIgnore error print stream.voidsetMessageOutputLevel(int level) Set the logging level when using this as a LoggervoidsetOutputPrintStream(PrintStream output) Set the output stream to which logging output is sent when operating as a logger.voidtargetFinished(BuildEvent event) Fired when a target finishes building, this adds the time taken and any error stacktrace to the appropriate target element in the log.voidtargetStarted(BuildEvent event) Fired when a target starts building, this pushes a timed element for the target onto the stack of elements for the current thread, remembering the current time and the name of the target.voidtaskFinished(BuildEvent event) Fired when a task finishes building, this adds the time taken and any error stacktrace to the appropriate task element in the log.voidtaskStarted(BuildEvent event) Fired when a task starts building, this pushes a timed element for the task onto the stack of elements for the current thread, remembering the current time and the name of the task.
- 
Constructor Details- 
XmlLoggerpublic XmlLogger()
 
- 
- 
Method Details- 
buildStartedFired when the build starts, this builds the top-level element for the document and remembers the time of the start of the build.- Specified by:
- buildStartedin interface- BuildListener
- Parameters:
- event- Ignored.
 
- 
buildFinishedFired when the build finishes, this adds the time taken and any error stacktrace to the build element and writes the document to disk.- Specified by:
- buildFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
targetStartedFired when a target starts building, this pushes a timed element for the target onto the stack of elements for the current thread, remembering the current time and the name of the target.- Specified by:
- targetStartedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
targetFinishedFired when a target finishes building, this adds the time taken and any error stacktrace to the appropriate target element in the log.- Specified by:
- targetFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
taskStartedFired when a task starts building, this pushes a timed element for the task onto the stack of elements for the current thread, remembering the current time and the name of the task.- Specified by:
- taskStartedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
taskFinishedFired when a task finishes building, this adds the time taken and any error stacktrace to the appropriate task element in the log.- Specified by:
- taskFinishedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
messageLoggedFired when a message is logged, this adds a message element to the most appropriate parent element (task, target or build) and records the priority and text of the message.- Specified by:
- messageLoggedin interface- BuildListener
- Parameters:
- event- An event with any relevant extra information. Will not be- null.
- See Also:
 
- 
setMessageOutputLevelpublic void setMessageOutputLevel(int level) Set the logging level when using this as a Logger- Specified by:
- setMessageOutputLevelin interface- BuildLogger
- Parameters:
- level- the logging level - see- Projectclass for level definitions
 
- 
getMessageOutputLevelpublic int getMessageOutputLevel()- Specified by:
- getMessageOutputLevelin interface- BuildLogger
- Returns:
- Returns the currently setmessage output level. Thedefaultimplementation of this method returnsMSG_INFO.
 
- 
setOutputPrintStreamSet the output stream to which logging output is sent when operating as a logger.- Specified by:
- setOutputPrintStreamin interface- BuildLogger
- Parameters:
- output- the output PrintStream.
 
- 
setEmacsModepublic void setEmacsMode(boolean emacsMode) Ignore emacs mode, as it has no meaning in XML format- Specified by:
- setEmacsModein interface- BuildLogger
- Parameters:
- emacsMode- true if logger should produce emacs compatible output
 
- 
setErrorPrintStreamIgnore error print stream. All output will be written to either the XML log file or the PrintStream provided to setOutputPrintStream- Specified by:
- setErrorPrintStreamin interface- BuildLogger
- Parameters:
- err- the stream we are going to ignore.
 
 
-