Java Code Examples for org.apache.tools.ant.BuildEvent#getPriority()

The following examples show how to use org.apache.tools.ant.BuildEvent#getPriority() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyBuildFileRule.java    From ph-schematron with Apache License 2.0 6 votes vote down vote up
/**
 * Fired whenever a message is logged.
 *
 * @see BuildEvent#getMessage()
 * @see BuildEvent#getPriority()
 */
public void messageLogged (final BuildEvent event)
{
  if (event.getPriority () > m_nLogLevel)
  {
    // ignore event
    return;
  }

  if (event.getPriority () == Project.MSG_INFO ||
      event.getPriority () == Project.MSG_WARN ||
      event.getPriority () == Project.MSG_ERR)
  {
    logBuffer.append (event.getMessage ()).append ('\n');
  }
  fullLogBuffer.append (event.getMessage ()).append ('\n');
}
 
Example 2
Source File: LoggingBuildListener.java    From ph-schematron with Apache License 2.0 6 votes vote down vote up
public void messageLogged (@Nonnull final BuildEvent aEvent)
{
  if (aEvent.getPriority () <= Project.MSG_ERR)
    LOGGER.error (aEvent.getMessage (), aEvent.getException ());
  else
    if (aEvent.getPriority () <= Project.MSG_WARN)
      LOGGER.warn (aEvent.getMessage (), aEvent.getException ());
    else
      if (aEvent.getPriority () <= Project.MSG_INFO)
        LOGGER.info (aEvent.getMessage (), aEvent.getException ());
      else
      {
        // Switch this from "debug" to "info" to get more output
        if (m_bDebugMode)
          LOGGER.info (aEvent.getMessage (), aEvent.getException ());
        else
          LOGGER.debug (aEvent.getMessage (), aEvent.getException ());
      }
}
 
Example 3
Source File: AntSLF4JLogger.java    From spoofax with Apache License 2.0 6 votes vote down vote up
@Override public void messageLogged(BuildEvent event) {
    switch(event.getPriority()) {
        case Project.MSG_ERR:
            log.error(event.getMessage());
            break;
        case Project.MSG_WARN:
            log.warn(event.getMessage());
            break;
        case Project.MSG_INFO:
            log.info(event.getMessage());
            break;
        default:
            log.trace(event.getMessage());
            break;
    }
}
 
Example 4
Source File: NbBuildLogger.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new regular event.
 * @param e the Ant build event
 * @param msgLogged true for logged events
 */
public Event(BuildEvent e, boolean msgLogged) {
    this.e = e;
    exception = e.getException();
    if (msgLogged) {
        level = e.getPriority();
    } else {
        level = -1;
    }
}
 
Example 5
Source File: NameBearerHandle.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * This is called for every log message (of any priority). If the
 * current process has been interrupted (the user pressed the stop
 * button) then we throw an exception to interrupt the currently
 * executing Ant task. Other than that, we simply pass INFO and
 * higher messages to the GATE status listener.
 */
@Override
public void messageLogged(BuildEvent buildEvent) {
  // check for interruption
  if(interrupted) {
    interrupted = false;
    throw new BuildException("Export interrupted");
  }
  if(buildEvent.getPriority() <= Project.MSG_INFO) {
    statusChanged(buildEvent.getMessage());
  }
  // log the message to log4j for debugging purposes
  log.debug(buildEvent.getPriority() + ": " + buildEvent.getMessage());
}
 
Example 6
Source File: LangtoolsIdeaAntLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void messageLogged(BuildEvent event) {
    String msg = event.getMessage();

    boolean processed = false;

    if (!tasks.isEmpty()) {
        Task task = tasks.peek();
        for (MessageKind messageKind : task.msgs) {
            if (messageKind.matches(msg)) {
                event.setMessage(msg, messageKind.priority);
                processed = true;
                if (messageKind == MessageKind.JAVAC_CRASH) {
                    crashFound = true;
                }
                break;
            }
        }
    }

    if (event.getPriority() == MSG_ERR || crashFound) {
        //we log errors regardless of owning task
        logger.messageLogged(event);
        suppressTaskFailures = true;
    } else if (processed) {
        logger.messageLogged(event);
    }
}
 
Example 7
Source File: JdkIdeaAntLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void messageLogged(BuildEvent event) {
    String msg = event.getMessage();

    boolean processed = false;

    if (!tasks.isEmpty()) {
        Task task = tasks.peek();
        for (MessageKind messageKind : task.msgs) {
            if (messageKind.matches(msg)) {
                event.setMessage(msg, messageKind.priority);
                processed = true;
                if (messageKind == MessageKind.JAVAC_CRASH) {
                    crashFound = true;
                }
                break;
            }
        }
    }

    if (event.getPriority() == MSG_ERR || crashFound) {
        //we log errors regardless of owning task
        logger.messageLogged(event);
        suppressTaskFailures = true;
    } else if (processed) {
        logger.messageLogged(event);
    }
}
 
Example 8
Source File: XtendCompilerAntTaskTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Fired whenever a message is logged.
 * 
 * @see BuildEvent#getMessage()
 * @see BuildEvent#getPriority()
 */
@Override
public void messageLogged(BuildEvent event) {
	if (event.getPriority() > logLevel) {
		// ignore event
		return;
	}
	if (event.getPriority() == Project.MSG_INFO || event.getPriority() == Project.MSG_WARN
			|| event.getPriority() == Project.MSG_ERR) {
		logBuffer.append(event.getMessage());
	}
}
 
Example 9
Source File: AntTestListener.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
/**
 * Fired whenever a message is logged.
 *
 * @param event
 *            BuildEvent
 * @see BuildEvent#getMessage()
 * @see BuildEvent#getPriority()
 */
public void messageLogged(BuildEvent event) {
    if (event.getPriority() > logLevel) {
        // ignore event
        return;
    }

    buildLog.append(event.getMessage());
}