当前位置: 首页>>代码示例>>Java>>正文


Java Log.info方法代码示例

本文整理汇总了Java中org.apache.commons.logging.Log.info方法的典型用法代码示例。如果您正苦于以下问题:Java Log.info方法的具体用法?Java Log.info怎么用?Java Log.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.logging.Log的用法示例。


在下文中一共展示了Log.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logThreadInfo

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log the current thread stacks at INFO level.
 * @param log the logger that logs the stack trace
 * @param title a descriptive title for the call stacks
 * @param minInterval the minimum time from the last 
 */
public static void logThreadInfo(Log log,
                                 String title,
                                 long minInterval) {
  boolean dumpStack = false;
  if (log.isInfoEnabled()) {
    synchronized (ReflectionUtils.class) {
      long now = Time.now();
      if (now - previousLogTime >= minInterval * 1000) {
        previousLogTime = now;
        dumpStack = true;
      }
    }
    if (dumpStack) {
      try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        printThreadInfo(new PrintStream(buffer, false, "UTF-8"), title);
        log.info(buffer.toString(Charset.defaultCharset().name()));
      } catch (UnsupportedEncodingException ignored) {
      }
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:29,代码来源:ReflectionUtils.java

示例2: logException

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
@VisibleForTesting
void logException(Log logger, Throwable e, Call call) {
  if (exceptionsHandler.isSuppressedLog(e.getClass())) {
    return; // Log nothing.
  }

  final String logMsg = Thread.currentThread().getName() + ", call " + call;
  if (exceptionsHandler.isTerseLog(e.getClass())) {
    // Don't log the whole stack trace. Way too noisy!
    logger.info(logMsg + ": " + e);
  } else if (e instanceof RuntimeException || e instanceof Error) {
    // These exception types indicate something is probably wrong
    // on the server side, as opposed to just a normal exceptional
    // result.
    logger.warn(logMsg, e);
  } else {
    logger.info(logMsg, e);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:Server.java

示例3: executeInternal

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
@Override
protected void executeInternal() throws Throwable
{
    String moduleId = super.getModuleId();
    String name = super.getName();
    Log logger = LogFactory.getLog(moduleId + "." + name);
    switch (logLevel)
    {
    case INFO:
        logger.info(message);
        break;
    case WARN:
        logger.warn(message);
        break;
    case ERROR:
        logger.error(message);
        break;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:LoggerModuleComponent.java

示例4: logThreadInfo

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log the current thread stacks at INFO level.
 * @param log the logger that logs the stack trace
 * @param title a descriptive title for the call stacks
 * @param minInterval the minimum time from the last 
 */
public static void logThreadInfo(Log log,
                                 String title,
                                 long minInterval) {
  boolean dumpStack = false;
  if (log.isInfoEnabled()) {
    synchronized (ReflectionUtils.class) {
      long now = System.currentTimeMillis();
      if (now - previousLogTime >= minInterval * 1000) {
        previousLogTime = now;
        dumpStack = true;
      }
    }
    if (dumpStack) {
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      printThreadInfo(new PrintWriter(buffer), title);
      log.info(buffer.toString());
    }
  }
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:26,代码来源:ReflectionUtils.java

示例5: logThreadInfo

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log the current thread stacks at INFO level.
 * @param log the logger that logs the stack trace
 * @param title a descriptive title for the call stacks
 * @param minInterval the minimum time from the last
 */
public static void logThreadInfo(Log log,
                                 String title,
                                 long minInterval) {
  boolean dumpStack = false;
  if (log.isInfoEnabled()) {
    synchronized (ReflectionUtils.class) {
      long now = System.currentTimeMillis();
      if (now - previousLogTime >= minInterval * 1000) {
        previousLogTime = now;
        dumpStack = true;
      }
    }
    if (dumpStack) {
      try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        printThreadInfo(new PrintStream(buffer, false, "UTF-8"), title);
        log.info(buffer.toString(Charset.defaultCharset().name()));
      } catch (UnsupportedEncodingException ignored) {
        log.warn("Could not write thread info about '" + title +
            "' due to a string encoding issue.");
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:ReflectionUtils.java

示例6: displayRetiredJobNotice

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Display a notice on the log that the current MapReduce job has
 * been retired, and thus Counters are unavailable.
 * @param log the Log to display the info to.
 */
protected void displayRetiredJobNotice(Log log) {
  log.info("The MapReduce job has already been retired. Performance");
  log.info("counters are unavailable. To get this information, ");
  log.info("you will need to enable the completed job store on ");
  log.info("the jobtracker with:");
  log.info("mapreduce.jobtracker.persist.jobstatus.active = true");
  log.info("mapreduce.jobtracker.persist.jobstatus.hours = 1");
  log.info("A jobtracker restart is required for these settings");
  log.info("to take effect.");
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:16,代码来源:JobBase.java

示例7: auditStarted

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void auditStarted(AuditEvent aEvt)
{
    if (mInitialized) {
        final Log log = mLogFactory.getInstance(Checker.class);
        log.info("Audit started.");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:CommonsLoggingListener.java

示例8: auditFinished

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void auditFinished(AuditEvent aEvt)
{
    if (mInitialized) {
        final Log log = mLogFactory.getInstance(Checker.class);
        log.info("Audit finished.");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:CommonsLoggingListener.java

示例9: fileStarted

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void fileStarted(AuditEvent aEvt)
{
    if (mInitialized) {
        final Log log = mLogFactory.getInstance(Checker.class);
        log.info("File \"" + aEvt.getFileName() + "\" started.");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:CommonsLoggingListener.java

示例10: fileFinished

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void fileFinished(AuditEvent aEvt)
{
    if (mInitialized) {
        final Log log = mLogFactory.getInstance(Checker.class);
        log.info("File \"" + aEvt.getFileName() + "\" finished.");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:CommonsLoggingListener.java

示例11: addError

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void addError(AuditEvent aEvt)
{
    final SeverityLevel severityLevel = aEvt.getSeverityLevel();
    if (mInitialized && !SeverityLevel.IGNORE.equals(severityLevel)) {
        final Log log = mLogFactory.getInstance(aEvt.getSourceName());

        final String fileName = aEvt.getFileName();
        final String message = aEvt.getMessage();

        // avoid StringBuffer.expandCapacity
        final int bufLen = message.length() + BUFFER_CUSHION;
        final StringBuffer sb = new StringBuffer(bufLen);

        sb.append("Line: ").append(aEvt.getLine());
        if (aEvt.getColumn() > 0) {
            sb.append(" Column: ").append(aEvt.getColumn());
        }
        sb.append(" Message: ").append(message);

        if (aEvt.getSeverityLevel().equals(SeverityLevel.WARNING)) {
            log.warn(sb.toString());
        }
        else if (aEvt.getSeverityLevel().equals(SeverityLevel.INFO)) {
            log.info(sb.toString());
        }
        else {
            log.error(sb.toString());
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:CommonsLoggingListener.java

示例12: logStorageContents

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static void logStorageContents(Log LOG, NNStorage storage) {
  LOG.info("current storages and corresponding sizes:");
  for (StorageDirectory sd : storage.dirIterable(null)) {
    File curDir = sd.getCurrentDir();
    LOG.info("In directory " + curDir);
    File[] files = curDir.listFiles();
    Arrays.sort(files);
    for (File f : files) {
      LOG.info("  file " + f.getAbsolutePath() + "; len = " + f.length());  
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:FSImageTestUtil.java

示例13: logUpgradePathSQL

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log out the SQL that forms this upgrade path to a logger of your choice.
 *
 * @param logger the logger to use.
 */
public void logUpgradePathSQL(Log logger) {
  if (sql.isEmpty()) {
    logger.info("No upgrade statements to be applied");
  } else {
    logger.info("Upgrade statements:\n" + getUpgradeSqlScript());
  }
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:13,代码来源:UpgradePath.java

示例14: setServerSideHConnectionRetriesConfig

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Changes the configuration to set the number of retries needed when using HConnection
 * internally, e.g. for  updating catalog tables, etc.
 * Call this method before we create any Connections.
 * @param c The Configuration instance to set the retries into.
 * @param log Used to log what we set in here.
 */
public static void setServerSideHConnectionRetriesConfig(
    final Configuration c, final String sn, final Log log) {
  // TODO: Fix this. Not all connections from server side should have 10 times the retries.
  int hcRetries = c.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
    HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
  // Go big.  Multiply by 10.  If we can't get to meta after this many retries
  // then something seriously wrong.
  int serversideMultiplier = c.getInt("hbase.client.serverside.retries.multiplier", 10);
  int retries = hcRetries * serversideMultiplier;
  c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, retries);
  log.info(sn + " server-side HConnection retries=" + retries);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:ConnectionUtils.java

示例15: initWebApplicationContext

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Initialize Spring's web application context for the given servlet context,
 * using the application context provided at construction time, or creating a new one
 * according to the "{@link #CONTEXT_CLASS_PARAM contextClass}" and
 * "{@link #CONFIG_LOCATION_PARAM contextConfigLocation}" context-params.
 * @param servletContext current servlet context
 * @return the new WebApplicationContext
 * @see #ContextLoader(WebApplicationContext)
 * @see #CONTEXT_CLASS_PARAM
 * @see #CONFIG_LOCATION_PARAM
 */
public WebApplicationContext initWebApplicationContext(ServletContext servletContext) {
	if (servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null) {
		throw new IllegalStateException(
				"Cannot initialize context because there is already a root application context present - " +
				"check whether you have multiple ContextLoader* definitions in your web.xml!");
	}

	Log logger = LogFactory.getLog(ContextLoader.class);
	servletContext.log("Initializing Spring root WebApplicationContext");
	if (logger.isInfoEnabled()) {
		logger.info("Root WebApplicationContext: initialization started");
	}
	long startTime = System.currentTimeMillis();

	try {
		// Store context in local instance variable, to guarantee that
		// it is available on ServletContext shutdown.
		if (this.context == null) {
			this.context = createWebApplicationContext(servletContext);
		}
		if (this.context instanceof ConfigurableWebApplicationContext) {
			ConfigurableWebApplicationContext cwac = (ConfigurableWebApplicationContext) this.context;
			if (!cwac.isActive()) {
				// The context has not yet been refreshed -> provide services such as
				// setting the parent context, setting the application context id, etc
				if (cwac.getParent() == null) {
					// The context instance was injected without an explicit parent ->
					// determine parent for root web application context, if any.
					ApplicationContext parent = loadParentContext(servletContext);
					cwac.setParent(parent);
				}
				configureAndRefreshWebApplicationContext(cwac, servletContext);
			}
		}
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);

		ClassLoader ccl = Thread.currentThread().getContextClassLoader();
		if (ccl == ContextLoader.class.getClassLoader()) {
			currentContext = this.context;
		}
		else if (ccl != null) {
			currentContextPerThread.put(ccl, this.context);
		}

		if (logger.isDebugEnabled()) {
			logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" +
					WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + "]");
		}
		if (logger.isInfoEnabled()) {
			long elapsedTime = System.currentTimeMillis() - startTime;
			logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms");
		}

		return this.context;
	}
	catch (RuntimeException ex) {
		logger.error("Context initialization failed", ex);
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
		throw ex;
	}
	catch (Error err) {
		logger.error("Context initialization failed", err);
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err);
		throw err;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:78,代码来源:ContextLoader.java


注:本文中的org.apache.commons.logging.Log.info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。