Package org.apache.uima.util

Examples of org.apache.uima.util.Logger


                  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


        resMgr = UIMAFramework.newDefaultResourceManager();
      }

      // get a Logger for this class and set its ResourceManager so that
      // UIMA extension ClassLoader is used to locate message digests.
      Logger logger = UIMAFramework.getLogger(this.getClass());
      logger.setResourceManager(resMgr);
     
      ConfigurationManager configMgr = null;
      if (aAdditionalParams != null) {
        configMgr = (ConfigurationManager)aAdditionalParams.get(PARAM_CONFIG_MANAGER);
      }
      if (configMgr == null) {
        configMgr = UIMAFramework.newConfigurationManager();
      }

      // create and initialize UIMAContext
      mUimaContextAdmin = UIMAFramework.newUimaContext(logger, resMgr, configMgr);

    } else {
      // configure logger of the UIMA context so that class-specific logging
      // levels and UIMA extension classLoader will work
      // get a Logger for this class and set its ResourceManager so that
      // UIMA extension ClassLoader is used to locate message digests.
      Logger logger = UIMAFramework.getLogger(this.getClass());
      logger.setResourceManager(mUimaContextAdmin.getResourceManager());
      mUimaContextAdmin.setLogger(logger);
    }

    // if this is a local resource (instantiated from a ResourceCreationSpecifier),
    // initialize the ResourceManager and UIMA Context.
View Full Code Here

      // add resource manager (initialized by superclass) to aAdditionalParams map
      // so that delegate AEs will share it
      aAdditionalParams.put(Resource.PARAM_RESOURCE_MANAGER, getResourceManager());

      Logger logger = getLogger();
      initializeAggregateAnalysisEngine(mDescription, aAdditionalParams);
      // above call sets the logger to something associated with the ASB,
      //   because the ASB is a subclass of Resource_ImplBase
      // Set it back to what it was.
      setLogger(logger);
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

      initParams.put(AnalysisEngine.PARAM_NUM_SIMULTANEOUS_REQUESTS, new Integer(numInstances));
      serviceImpl.initialize(resourceSpecifier, initParams);

      // disable logging for Analysis Engines if deployer so indicated
      if (!enableLog && serviceImpl instanceof AnalysisEngineService_impl) {
        Logger nullLogger = UIMAFramework.newLogger();
        nullLogger.setOutputStream(null);

        ((AnalysisEngineService_impl) serviceImpl).getAnalysisEngine().setLogger(nullLogger);
      }

      mResourceServiceImplMap.put(serviceName, serviceImpl);
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

     * (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

                  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.