List of usage examples for org.apache.commons.logging Log fatal
void fatal(Object message, Throwable t);
From source file:org.openmrs.web.Listener.java
public static void performWebStartOfModules(Collection<Module> startedModules, ServletContext servletContext) throws ModuleMustStartException, Exception { Log log = LogFactory.getLog(Listener.class); boolean someModuleNeedsARefresh = false; for (Module mod : startedModules) { try {/* ww w .j ava2s . c o m*/ boolean thisModuleCausesRefresh = WebModuleUtil.startModule(mod, servletContext, /* delayContextRefresh */true); someModuleNeedsARefresh = someModuleNeedsARefresh || thisModuleCausesRefresh; } catch (Exception e) { mod.setStartupErrorMessage("Unable to start module", e); } } if (someModuleNeedsARefresh) { try { WebModuleUtil.refreshWAC(servletContext, true, null); } catch (ModuleMustStartException ex) { // pass this up to the calling method so that openmrs loading stops throw ex; } catch (BeanCreationException ex) { // pass this up to the calling method so that openmrs loading stops throw ex; } catch (Exception e) { Throwable rootCause = getActualRootCause(e, true); if (rootCause != null) { log.fatal("Unable to refresh the spring application context. Root Cause was:", rootCause); } else { log.fatal( "Unable to refresh the spring application context. Unloading all modules, Error was:", e); } try { WebModuleUtil.shutdownModules(servletContext); for (Module mod : ModuleFactory.getLoadedModules()) {// use loadedModules to avoid a concurrentmodificationexception if (!mod.isCoreModule() && !mod.isMandatory()) { try { ModuleFactory.stopModule(mod, true, true); } catch (Exception t3) { // just keep going if we get an error shutting down. was probably caused by the module // that actually got us to this point! log.trace("Unable to shutdown module:" + mod, t3); } } } WebModuleUtil.refreshWAC(servletContext, true, null); } catch (MandatoryModuleException ex) { // pass this up to the calling method so that openmrs loading stops throw new MandatoryModuleException(ex.getModuleId(), "Got an error while starting a mandatory module: " + e.getMessage() + ". Check the server logs for more information"); } catch (Exception t2) { // a mandatory or core module is causing spring to fail to start up. We don't want those // stopped so we must report this error to the higher authorities log.warn("caught another error: ", t2); throw t2; } } } // because we delayed the refresh, we need to load+start all servlets and filters now // (this is to protect servlets/filters that depend on their module's spring xml config being available) for (Module mod : ModuleFactory.getStartedModules()) { WebModuleUtil.loadServlets(mod, servletContext); WebModuleUtil.loadFilters(mod, servletContext); } }
From source file:org.qedeq.base.trace.Trace.java
/** * Trace fatal throwable and extra description. * * @param tracingClass Class that wants to make a trace entry. * @param tracingObject Instance that wants to make a trace entry. * @param method Method of that object. * @param description Further information. * @param throwable Throwable to trace. *//*from w ww . j a v a2 s .c o m*/ public static void fatal(final Class tracingClass, final Object tracingObject, final String method, final String description, final Throwable throwable) { final Log log = LogFactory.getFactory().getInstance(tracingClass); log.fatal("." + method + " " + description, throwable); }
From source file:org.qedeq.base.trace.Trace.java
/** * Trace fatal throwable and extra description. * * @param tracingClass Class that wants to make a trace entry. * @param method Method of that class. * @param description Further information. * @param throwable Throwable to trace. *//* w w w. ja v a2s. c o m*/ public static void fatal(final Class tracingClass, final String method, final String description, final Throwable throwable) { final Log log = LogFactory.getFactory().getInstance(tracingClass); log.fatal("." + method + " " + description, throwable); }
From source file:org.seasar.mayaa.impl.util.xml.XMLHandler.java
public void fatalError(SAXParseException e) { Log log = getLog(); if (log != null && log.isFatalEnabled()) { log.fatal(e.getMessage(), e); }/*from w ww. j av a2 s . c o m*/ throw new RuntimeException(e); }
From source file:org.springframework.flex.core.CommonsLoggingTarget.java
public void logEvent(LogEvent logevent) { String category = logevent.logger.getCategory(); if (this.categoryPrefix != null) { category = this.categoryPrefix + "." + category; }/*from ww w . jav a 2 s.com*/ Log log = LogFactory.getLog(category); switch (logevent.level) { case LogEvent.FATAL: if (log.isFatalEnabled()) { log.fatal(logevent.message, logevent.throwable); } break; case LogEvent.ERROR: if (log.isErrorEnabled()) { log.error(logevent.message, logevent.throwable); } break; case LogEvent.WARN: if (log.isWarnEnabled()) { log.warn(logevent.message, logevent.throwable); } break; case LogEvent.INFO: if (log.isInfoEnabled()) { log.info(logevent.message, logevent.throwable); } break; case LogEvent.DEBUG: if (log.isDebugEnabled()) { log.debug(logevent.message, logevent.throwable); } break; case LogEvent.ALL: if (log.isTraceEnabled()) { log.trace(logevent.message, logevent.throwable); } break; default: break; } }