Package org.apache.uima.util

Examples of org.apache.uima.util.Logger


    }
  }

  // log a message
  public static void log(int msglevel, String sourceClass, String sourceMethod, String message) {
    Logger uimacppLogger = UIMAFramework.getLogger(UimacppAnalysisComponent.class);
    Level level = Level.INFO; // default
    if (msglevel == TAF_LOGLEVEL_MESSAGE) {
      level = Level.INFO;
    } else if (msglevel == TAF_LOGLEVEL_WARNING) {
      level = Level.WARNING;
    } else if (msglevel == TAF_LOGLEVEL_ERROR) {
      level = Level.SEVERE;
    }
    if (sourceMethod.length() > 0)
      uimacppLogger.log(level, sourceClass + "::" + sourceMethod + ": " + message);
    else
      uimacppLogger.log(level, sourceClass + ": " + message);

    // TODO: add Logger method log(level, sourceClass, sourceMethod, message);
  }
View Full Code Here


      // declares any input or output sofas in its capabilities)
      mSofaAware = getProcessingResourceMetaData().isSofaAware();
     
      // Set Logger, to enable component-specific logging configuration
      UimaContextAdmin uimaContext = getUimaContextAdmin();
      Logger logger = UIMAFramework.getLogger(mFlowController.getClass());
      logger.setResourceManager(this.getResourceManager());
      uimaContext.setLogger(logger);     
     
      // initialize FlowController
      mFlowController.initialize(getFlowControllerContext());
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.uima.jcas.jcasgen_gen.IError#newError(int, java.lang.String)
     */
    public void newError(int severity, String message, Exception ex) {
      Logger log = UIMAFramework.getLogger();
      log.log(logLevels[severity], "JCasGen: " + message); //$NON-NLS-1$
      System.out.println(Messages.getString("MultiPageEditor.JCasGenErr") //$NON-NLS-1$
              + message);
      if (null != ex)
        ex.printStackTrace();
      if (IError.WARN < severity) {
View Full Code Here

  private static Object getOptionalParameter(UimaContext context,
      String parameter) {

    Object value =  context.getConfigParameterValue(parameter);

    Logger logger = context.getLogger();

    if (logger.isLoggable(Level.INFO)) {
      logger.log(Level.INFO, parameter + " = " +
          (value != null ? value.toString() : "not set"));
    }

    return value;
  }
View Full Code Here

  Dictionary dictionary = null;

  if (dictionaryName != null) {

      Logger logger = context.getLogger();

      try {

    InputStream dictIn = CasConsumerUtil.getOptionalResourceAsStream(context,
      dictionaryName);

    if (dictIn == null) {
      String message = "The dictionary file " + dictionaryName +
      " does not exist!";

      if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
      }

      return null;
    }

    dictionary = new Dictionary(dictIn);

      } catch (IOException e) {
      // if this fails just print error message and continue
      String message = "IOException during dictionary reading, "
        + "running without dictionary: " + e.getMessage();

      if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
      }
      }

      return dictionary;
  } else
View Full Code Here

      String parameter)
      throws ResourceInitializationException {

    Object value = context.getConfigParameterValue(parameter);

    Logger logger = context.getLogger();

    if (logger.isLoggable(Level.INFO)) {
      logger.log(Level.INFO, parameter + " = " +
          (value != null ? value.toString() : "not set"));
    }

    return value;
  }
View Full Code Here

    Dictionary dictionary = null;

    if (dictionaryName != null) {

      Logger logger = context.getLogger();

      try {

        InputStream dictIn = AnnotatorUtil.getOptionalResourceAsStream(context,
            dictionaryName);

        if (dictIn == null) {
          String message = "The dictionary file " + dictionaryName
              + " does not exist!";

          if (logger.isLoggable(Level.WARNING)) {
            logger.log(Level.WARNING, message);
          }

          return null;
        }

        dictionary = new Dictionary(dictIn);

      } catch (IOException e) {
        // if this fails just print error message and continue
        String message = "IOException during dictionary reading, "
            + "running without dictionary: " + e.getMessage();

        if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
        }
      }

      return dictionary;
    } else
View Full Code Here

   * Get the logging level of the logger for TAFAnnotator. TAF only supports three levels of
   * logging. All logging levels INFO and below are mapped to the TAF message level.
   */
  public static int getLoggingLevel() {

    Logger uimacppLogger = UIMAFramework.getLogger(UimacppAnalysisComponent.class);

    if (uimacppLogger.isLoggable(Level.FINEST) || uimacppLogger.isLoggable(Level.FINER)
            || uimacppLogger.isLoggable(Level.FINE) || uimacppLogger.isLoggable(Level.CONFIG)
            || uimacppLogger.isLoggable(Level.INFO)) {
      return TAF_LOGLEVEL_MESSAGE;
    } else if (uimacppLogger.isLoggable(Level.WARNING)) {
      return TAF_LOGLEVEL_WARNING;
    } else if (uimacppLogger.isLoggable(Level.SEVERE)) {
      return TAF_LOGLEVEL_ERROR;
    } else {
      return TAF_LOGLEVEL_OFF;
    }
  }
View Full Code Here

    }
  }

  // log a message
  public static void log(int msglevel, String sourceClass, String sourceMethod, String message) {
    Logger uimacppLogger = UIMAFramework.getLogger(UimacppAnalysisComponent.class);
    Level level = Level.INFO; // default
    if (msglevel == TAF_LOGLEVEL_MESSAGE) {
      level = Level.INFO;
    } else if (msglevel == TAF_LOGLEVEL_WARNING) {
      level = Level.WARNING;
    } else if (msglevel == TAF_LOGLEVEL_ERROR) {
      level = Level.SEVERE;
    }
    if (sourceMethod.length() > 0)
      uimacppLogger.log(level, sourceClass + "::" + sourceMethod + ": " + message);
    else
      uimacppLogger.log(level, sourceClass + ": " + message);

    // TODO: add Logger method log(level, sourceClass, sourceMethod, message);
  }
View Full Code Here

                  annotatorClassName, mDescription.getSourceUrlString() }, e);
    }

    // Set Logger, to enable annotator-specific logging
    UimaContextAdmin uimaContext = getUimaContextAdmin();
    Logger logger = UIMAFramework.getLogger(annotatorClass);
    logger.setResourceManager(this.getResourceManager());
    uimaContext.setLogger(logger);

    // initialize AnalysisComponent
    try {
      mAnalysisComponent.initialize(getUimaContext());
View Full Code Here

TOP

Related Classes of org.apache.uima.util.Logger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.