public void messageLogged(BuildEvent event) {
   if (event.getPriority() == Project.MSG_INFO
       || event.getPriority() == Project.MSG_WARN
       || event.getPriority() == Project.MSG_ERR) {
     MyBuildFileTest.this.logBuffer.append(event.getMessage());
     MyBuildFileTest.this.logBuffer.append('\n');
   }
 }
 @Override
 public void messageLogged(BuildEvent be) {
   TraceManager.GetTrace()
       .trace(
           new Entry(
               String.format("", be.getMessage()),
               be.getPriority() != Project.MSG_ERR ? SeverityType.INFO : SeverityType.ERROR));
 }
  /**
   * 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.
   *
   * @param event An event with any relevant extra information. Will not be <code>null</code>.
   */
  public void messageLogged(BuildEvent event) {

    if (buildElement == null) {
      buildElement = new TimedElement();
      buildElement.startTime = System.currentTimeMillis();
      buildElement.element = doc.createElement(BUILD_TAG);
    }
    int priority = event.getPriority();
    if (priority > msgOutputLevel) {
      return;
    }
    Element messageElement = doc.createElement(MESSAGE_TAG);

    String name = "debug";
    switch (event.getPriority()) {
      case MSG_ERR:
        name = "error";
        break;
      case MSG_WARN:
        name = "warn";
        break;
      case MSG_INFO:
        name = "info";
        break;
      default:
        name = "debug";
        break;
    }
    messageElement.setAttribute(PRIORITY_ATTR, name);

    Throwable ex = event.getException();
    if (MSG_DEBUG <= msgOutputLevel && ex != null) {
      Text errText = doc.createCDATASection(StringUtils.getStackTrace(ex));
      Element stacktrace = doc.createElement(STACKTRACE_TAG);
      stacktrace.appendChild(errText);
      buildElement.element.appendChild(stacktrace);
    }
    Text messageText = doc.createCDATASection(event.getMessage());
    messageElement.appendChild(messageText);

    TimedElement parentElement = null;

    Task task = event.getTask();

    Target target = event.getTarget();
    if (task != null) {
      parentElement = getTaskElement(task);
    }
    if (parentElement == null && target != null) {
      parentElement = (TimedElement) targets.get(target);
    }

    /*
     * if (parentElement == null) { Stack threadStack = (Stack)
     * threadStacks.get(Thread.currentThread()); if (threadStack != null) {
     * if (!threadStack.empty()) { parentElement = (TimedElement)
     * threadStack.peek(); } } }
     */

    if (parentElement != null) {
      parentElement.element.appendChild(messageElement);
    } else {
      buildElement.element.appendChild(messageElement);
    }
  }