本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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++;
}
}
示例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());
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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());
}
}
}
示例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));
}