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

.

author Michiel Rook
version $Id: aaf7d77e9952319b9598d786c556be005d34c188 $
package phing.listener

 Methods

Constructs a new BuildListener that logs build events to an XML file.

__construct() 

Fired when the build finishes, this adds the time taken and any error stacktrace to the build element and writes the document to disk.

buildFinished(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when the build starts, this builds the top-level element for the document and remembers the time of the start of the build.

buildStarted(\BuildEvent $event) 

Parameters

$event

\BuildEvent

Ignored.

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.

messageLogged(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Sets the error stream.

setErrorStream(\OutputStream $err) 

Set the msgOutputLevel this logger is to respond to.

setMessageOutputLevel(int $level) 

Only messages with a message level lower than or equal to the given level are output to the log.

<

p> Constants for the message levels are in Project.php. The order of the levels, from least to most verbose, is:

  • Project::MSG_ERR
  • Project::MSG_WARN
  • Project::MSG_INFO
  • Project::MSG_VERBOSE
  • Project::MSG_DEBUG

The default message level for DefaultLogger is Project::MSG_ERR.

see \global\BuildLogger#setMessageOutputLevel()

Parameters

$level

int

The logging level for the logger.

Sets the output stream.

setOutputStream(\OutputStream $output) 

Fired when a target finishes building, this adds the time taken to the appropriate target element in the log.

targetFinished(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a target starts building, remembers the current time and the name of the target.

targetStarted(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a task finishes building, this adds the time taken to the appropriate task element in the log.

taskFinished(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

Fired when a task starts building, remembers the current time and the name of the task.

taskStarted(\BuildEvent $event) 

Parameters

$event

\BuildEvent

An event with any relevant extra information. Will not be null.

 Properties

 

Top-level (root) build element

$buildElement : \DOMElement
 

Start time for entire build.

$buildTimerStart : int
 

The XML document created by this logger.

$doc : \DOMDocument
 

DOMElement[] The parent of the element being processed.

$elementStack : array
 

Stream to use for error output.

$err : \OutputStream
 

$msgOutputLevel : int
 

Stream to use for standard output.

$out : \OutputStream
 

Name of filename to create.

$outFilename : string
 

int[] Array of millisecond times for the various elements being processed.

$timesStack : array

 Constants

 

XML element name for a build.

BUILD_TAG 
 

XML attribute name for an error description.

ERROR_ATTR 
 

XML attribute name for a file location.

LOCATION_ATTR 
 

XML element name for a message.

MESSAGE_TAG 
 

XML attribute name for a name.

NAME_ATTR 
 

XML attribute name for a message priority.

PRIORITY_ATTR 
 

XML element name for a stack trace.

STACKTRACE_TAG 
 

XML element name for a target.

TARGET_TAG 
 

XML element name for a task.

TASK_TAG 
 

XML attribute name for a time.

TIME_ATTR