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


Java Log.error方法代码示例

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


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

示例1: 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

示例2: onLogException

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
@Override
public boolean onLogException(Log logger, Throwable t, String message)
{
    if (t instanceof UnimportantTransformException )
    {
        logger.debug(message);
        return true;
    }
    else if (t instanceof UnsupportedTransformationException)
    {
        logger.error(message);
        return true;
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:TransformActionExecuter.java

示例3: instancia

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static FactoriaControlAgteReactivo instancia(){
    Log log = LogFactory.getLog(FactoriaControlAgteReactivo.class);
    if(instancia==null){
        String clase = System.getProperty("icaro.infraestructura.patronAgenteReactivo.control.factoriaEInterfaces.imp",
        		"icaro.infraestructura.patronAgenteReactivo.control.factoriaEInterfaces.imp.FactoriaControlAgteReactivoImp2");
        try{
            instancia = (FactoriaControlAgteReactivo)Class.forName(clase).newInstance();
        }catch(Exception ex){
            log.error("Implementacion del Control no encontrado",ex);
        }
        
    }
    return instancia;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:FactoriaControlAgteReactivo.java

示例4: instancia

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static FactoriaAgenteReactivo instancia(){
    Log log = LogFactory.getLog(FactoriaAgenteReactivo.class);
    if(instancia==null){
        String clase = System.getProperty("icaro.infraestructura.patronAgenteReactivo.factoriaEInterfaces.imp",
                "icaro.infraestructura.patronAgenteReactivo.factoriaEInterfaces.imp.FactoriaAgenteReactivoInputObjImp0");
        try{
            instancia = (FactoriaAgenteReactivo)Class.forName(clase).newInstance();
        }catch(Exception ex){
            log.error("Implementacion de la factoria: FactoriaAgenteReactivoImp no encontrada",ex);
        }
        
    }
    return instancia;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:FactoriaAgenteReactivo.java

示例5: instancia

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static FactoriaPercepcion instancia(){
    Log log = LogFactory.getLog(FactoriaPercepcion.class);
    if(instancia==null){
    	
        String clase = System.getProperty("icaro.infraestructura.patronAgenteReactivo.percepcion.factoriaEInterfaces.imp",
                "icaro.infraestructura.patronAgenteReactivo.percepcion.factoriaEInterfaces.imp.FactoriaPercepcionImp");
        try{
            instancia = (FactoriaPercepcion)Class.forName(clase).newInstance();
        }catch(Exception ex){
            log.error("Implementacion de la Percepcion no encontrado",ex);
        }
        
    }
    return instancia;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:16,代码来源:FactoriaPercepcion.java

示例6: logAll

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static void logAll(Log log, String message, SQLException e) {
  log.error(message == null ? "Top level exception: " : message, e);
  e = e.getNextException();
  int indx = 1;
  while (e != null) {
    log.error("Chained exception " + indx + ": ", e);
    e = e.getNextException();
    indx++;
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:11,代码来源:LoggingUtils.java

示例7: 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

示例8: addException

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

示例9: execute

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static Object execute(InstructionSet set,
		InstructionSetContext context, List<String> errorList, boolean isTrace,boolean isCatchException,
		boolean isReturnLastData,Log aLog) throws Exception {

RunEnvironment environmen = null;
Object result = null;
environmen = OperateDataCacheManager.fetRunEnvironment(set,
		(InstructionSetContext) context, isTrace);
try {
	CallResult tempResult = set.excute(environmen, context, errorList,
			isReturnLastData, aLog);
	if (tempResult.isExit() == true) {
		result = tempResult.getReturnValue();
	}
} catch (Exception e) {
	if (isCatchException == true) {
		if (aLog != null) {
			aLog.error(e.getMessage(), e);
		} else {
			log.error(e.getMessage(), e);
		}
	} else {
		throw e;
	}
}
return result;

}
 
开发者ID:alibaba,项目名称:QLExpress,代码行数:29,代码来源:InstructionSetRunner.java

示例10: 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

示例11: handleBlock

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * processes a <code>BlockDef</code> and resolves references in it
 *
 * @param block the <code>BlockDef</code> to process
 */
protected void handleBlock(BlockDef block) {
    SymTabAST node = block.getTreeNode();

    switch (node.getType()) {

        case TokenTypes.LITERAL_FOR :
            handleFor(block);
            break;

        case TokenTypes.LITERAL_IF :
            handleIf(block);
            break;

        case TokenTypes.LITERAL_WHILE :
            handleWhileAndSynchronized(block);
            break;

        case TokenTypes.LITERAL_DO :
            handleDoWhile(block);
            break;

        case TokenTypes.LITERAL_TRY :
        case TokenTypes.LITERAL_FINALLY :
            SymTabAST slist = node.findFirstToken(TokenTypes.SLIST);

            handleSList(slist, block);
            break;

        case TokenTypes.LITERAL_CATCH :
            handleCatch(block);
            break;

        case TokenTypes.LITERAL_SWITCH :
            handleSwitch(block);
            break;

        case TokenTypes.SLIST :
            handleSList(node, block);
            break;

        case TokenTypes.EXPR :
            resolveExpression(node, block, null, true);
            break;

        case TokenTypes.INSTANCE_INIT :
        case TokenTypes.STATIC_INIT :
            handleSList((SymTabAST) node.getFirstChild(), block);
            break;

        case TokenTypes.LITERAL_SYNCHRONIZED :
            handleWhileAndSynchronized(block);
            break;

        case TokenTypes.LITERAL_ASSERT :
            handleAssert(block);
            break;

        default :
            if (mInitialized) {
                final Log log = mLogFactory.getInstance(this.getClass());
                log.error(
                    "Unhandled block "
                        + block
                        + " of type "
                        + node.getType());
            }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:74,代码来源:Resolver.java

示例12: error

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log an I18Nized message to ERROR.
 * 
 * @param logger        the logger to use
 * @param messageKey    the message key
 * @param args          the required message arguments
 */
public static final void error(Log logger, String messageKey, Object ... args)
{
    logger.error(I18NUtil.getMessage(messageKey, args));
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:12,代码来源:LogUtil.java


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