Java Code Examples for org.apache.tools.ant.Project#MSG_WARN

The following examples show how to use org.apache.tools.ant.Project#MSG_WARN . 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: AntHandler.java    From scriptella-etl with Apache License 2.0 6 votes vote down vote up
/**
 * Converts JUL level to appropriate Ant message priority
 *
 * @param level JUL level
 * @return Ant message priority
 */
private int convert(Level level) {
    final int lev = level.intValue();
    if (lev >= Level.SEVERE.intValue()) {
        return Project.MSG_ERR;
    }
    if (lev >= Level.WARNING.intValue()) {
        return Project.MSG_WARN;
    }
    if (lev >= Level.INFO.intValue()) {
        return Project.MSG_INFO;
    }
    if (debug) {
        return Project.MSG_INFO;
    }
    if (lev >= Level.FINE.intValue()) {
        return Project.MSG_VERBOSE;
    }
    if (lev > Level.OFF.intValue()) {
        return Project.MSG_DEBUG;
    }
    return -1;
}
 
Example 2
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 3
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 4
Source File: TaskLogger.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected int getMessageLevel( LogRecord record )
{
	Level level = record.getLevel( );
	if ( level.equals( Level.SEVERE ) )
	{
		return Project.MSG_ERR;
	}
	if ( level.equals( Level.WARNING ) )
	{
		return Project.MSG_WARN;
	}
	if ( level.equals( Level.INFO ) )
	{
		return Project.MSG_INFO;
	}
	return Project.MSG_VERBOSE;
}
 
Example 5
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 6
Source File: ForkedJavaOverride.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setProcessErrorStream(InputStream inputStream) throws IOException {
    OutputStream os = getErrorStream();
    Integer logLevel = null;
    if (os == null || delegateErrorStream) {
        os = AntBridge.delegateOutputStream(true);
        logLevel = Project.MSG_WARN;
    }
    errTask = new Thread(Thread.currentThread().getThreadGroup(), errCopier = new Copier(inputStream, os, logLevel, errEncoding, foldingHelper),
            "Err Thread for " + getProject().getName()); // NOI18N
    errTask.setDaemon(true);
    errTask.start();
}
 
Example 7
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 8
Source File: AntErrorManager.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void printSummary() {
  String message =
      getErrorCount() + " error(s), " + getWarningCount() + " warning(s)";

  if (getTypedPercent() > 0.0) {
    message += ", " + getTypedPercent() + " typed";
  }

  int level = (getErrorCount() + getWarningCount() == 0) ?
      Project.MSG_INFO : Project.MSG_WARN;
  this.task.log(message, level);
}