List of usage examples for org.apache.commons.logging Log warn
void warn(Object message);
From source file:com.siblinks.ws.common.BaseException.java
public void log(final Log log) { if (errorLevel.equals(ErrorLevel.INFO) && log.isDebugEnabled()) { log.debug("Info Message: ID - " + uniqueID + " User Message: " + userMessageKey); log.debug(StackTracer.getStackTrace(throwable)); } else if (errorLevel.equals(ErrorLevel.WARNING) && log.isWarnEnabled()) { log.warn("Warn Message: ID - " + uniqueID + " User Message: " + userMessageKey); log.warn(StackTracer.getStackTrace(throwable)); } else if (errorLevel.equals(ErrorLevel.ERROR) && log.isErrorEnabled()) { log.error("Error Message: ID - " + uniqueID + " User Message: " + userMessageKey); log.error(StackTracer.getStackTrace(throwable)); } else if (errorLevel.equals(ErrorLevel.FATAL) && log.isFatalEnabled()) { log.fatal("Fatal Message: ID - " + uniqueID + " User Message: " + userMessageKey); log.fatal(StackTracer.getStackTrace(throwable)); }/*from w w w. j a v a 2 s . c o m*/ logged = true; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the warn level. If the log level is not enabled, this method does * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned. * * @param log the log where the messages will go * @param basename the base name of the resource bundle * @param key the resource bundle key name * @param varargs arguments to help fill in the resource bundle message * * @return if the message was logged, a non-<code>null</code> Msg object is returned *//*from ww w. j a va 2 s . c o m*/ public static Msg warn(Log log, BundleBaseName basename, String key, Object... varargs) { if (log.isWarnEnabled()) { Msg msg = Msg.createMsg(basename, key, varargs); log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:io.smartspaces.workbench.project.test.IsolatedJavaTestRunner.java
/** * Run the given tests in the given classLoader. * * @param testCompilationFolder/* w w w . ja v a2 s. c o m*/ * the folder for * @param classLoader * class loader to use for running tests * @param log * logger for the test run * * @return {@code true} if all tests passed */ public boolean runTests(File testCompilationFolder, URLClassLoader classLoader, Log log) { // Get all JUnit tests JunitTestClassDetector detector = new JunitTestClassDetector(); List<Class<?>> testClasses = detector.findTestClasses(testCompilationFolder, classLoader, log); if (!testClasses.isEmpty()) { return runJunitTests(testClasses, log); } else { log.warn(String.format("No JUnit test classes found in %s", testCompilationFolder.getAbsolutePath())); // No tests. Claim they successfully ran anyway. return true; } }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the warn level. If the log level is not enabled, this method does * nothing and returns <code>null</code>. If a message was logged, its {@link Msg} will be returned. * * @param log the log where the messages will go * @param basename the base name of the resource bundle * @param locale the locale to determine what bundle to use * @param key the resource bundle key name * @param varargs arguments to help fill in the resource bundle message * * @return if the message was logged, a non-<code>null</code> Msg object is returned *//*from ww w . j a va 2 s .co m*/ public static Msg warn(Log log, BundleBaseName basename, Locale locale, String key, Object... varargs) { if (log.isWarnEnabled()) { Msg msg = Msg.createMsg(basename, locale, key, varargs); log.warn((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:net.java.dev.weblets.impl.WebletContainerImpl.java
private void checkWebletsContextPath() { if (_webletContextPath == null || _webletContextPath.trim().equals("")) { //the setup context path defaults to empty lets determine another one if possible Log log = LogFactory.getLog(WebletContainerImpl.class); log.warn("No net.java.dev.weblets.contextpath context-param has been set" + " this might cause problems in non jsf environments! "); } else {//from www.ja v a 2 s .c o m if (_webletContextPath.endsWith("/")) _webletContextPath = _webletContextPath.substring(Const.FIRST_PARAM, _webletContextPath.length() - Const.SECOND_PARAM); } }
From source file:it.caladyon.akka.commonslog.CommonsLoggingLogger.java
@Override public void onReceive(Object message) throws Exception { if (message instanceof InitializeLogger) { loggerLog.info(message);/*from w ww. j a v a2 s.c om*/ getSender().tell(Logging.loggerInitialized(), getSelf()); } else if (message instanceof Error) { Log log = LogFactory.getLog(((Error) message).logClass()); if (((Error) message).cause() == null) { log.error(composeMessage((LogEvent) message)); } else { log.error(composeMessage((LogEvent) message), ((Error) message).cause()); } } else if (message instanceof Warning) { Log log = LogFactory.getLog(((Warning) message).logClass()); log.warn(composeMessage((LogEvent) message)); } else if (message instanceof Info) { Log log = LogFactory.getLog(((Info) message).logClass()); if (log.isInfoEnabled()) { log.info(composeMessage((LogEvent) message)); } } else if (message instanceof Debug) { Log log = LogFactory.getLog(((Debug) message).logClass()); if (log.isDebugEnabled()) { log.debug(composeMessage((LogEvent) message)); } } }
From source file:com.agiletec.apsadmin.tags.util.ParamMap.java
@Override public boolean end(Writer writer, String body) { Log log = LogFactory.getLog(ParamMap.class); Component component = this.findAncestor(Component.class); if (null == this.getMap()) { log.info("Attribute map is mandatory."); return super.end(writer, body); }/*from w w w.j a v a 2 s . co m*/ Object object = this.findValue(this.getMap()); if (null == object) { log.debug("Map not found in ValueStack"); return super.end(writer, body); } if (!(object instanceof Map)) { log.warn("Error in JSP. Attribute map must evaluate to java.util.Map. Found type: " + object.getClass().getName()); return super.end(writer, body); } component.addAllParameters((Map) object); return super.end(writer, body); }
From source file:io.smartspaces.liveactivity.runtime.configuration.BasePropertyFileLiveActivityConfigurationManager.java
@Override public StandardLiveActivityConfiguration newLiveActivityConfiguration(InstalledLiveActivity liveActivity, InternalLiveActivityFilesystem activityFilesystem) { ExpressionEvaluator expressionEvaluator = expressionEvaluatorFactory.newEvaluator(); File baseActivityConfiguration = getBaseActivityConfiguration(liveActivity, activityFilesystem); SingleConfigurationStorageManager baseConfigurationStorageManager = newConfiguration( baseActivityConfiguration, true, expressionEvaluator); File installedActivityConfiguration = getInstalledActivityConfiguration(liveActivity, activityFilesystem); boolean configurationFileRequired = isInstalledActivityConfigurationFileRequired(); SingleConfigurationStorageManager installedActivityConfigurationStorageManager = newConfiguration( installedActivityConfiguration, configurationFileRequired, expressionEvaluator); Log log = spaceEnvironment.getLog(); boolean fileExists = installedActivityConfiguration.exists(); String absolutePath = installedActivityConfiguration.getAbsolutePath(); if (fileExists) { log.info("Using installed activity configuration file " + absolutePath); } else if (configurationFileRequired) { log.error("Missing required installed activity configuration file " + absolutePath); } else {//from w w w . j av a 2 s . co m log.warn("Skipping missing installed activity configuration file " + absolutePath); } StandardLiveActivityConfiguration configuration = new StandardLiveActivityConfiguration( baseConfigurationStorageManager, installedActivityConfigurationStorageManager, expressionEvaluator, spaceEnvironment.getSystemConfiguration()); // TODO(keith): Given where we are, should the symbol tables be cleared? expressionEvaluator.getEvaluationEnvironment().addSymbolTableFront(configuration.asSymbolTable()); return configuration; }
From source file:com.amazon.carbonado.repo.tupl.LogEventListener.java
@Override public void notify(EventType type, String message, Object... args) { int intLevel = type.level.intValue(); Log log = mLog; if (log != null) { if (intLevel <= Level.INFO.intValue()) { if (type.category == EventType.Category.CHECKPOINT) { if (log.isDebugEnabled()) { log.debug(format(type, message, args)); }/*from w w w.j a v a 2s.c om*/ } else if (log.isInfoEnabled()) { log.info(format(type, message, args)); } } else if (intLevel <= Level.WARNING.intValue()) { if (log.isWarnEnabled()) { log.warn(format(type, message, args)); } } else if (intLevel <= Level.SEVERE.intValue()) { if (log.isFatalEnabled()) { log.fatal(format(type, message, args)); } } } if (intLevel > Level.WARNING.intValue() && mPanicHandler != null) { mPanicHandler.onPanic(mDatabase, type, message, args); } }
From source file:interactivespaces.workbench.project.test.IsolatedJavaTestRunner.java
/** * Run the given tests in the given classLoader. * * @param testCompilationFolder//from w w w.j a va 2 s . c om * the folder for * @param classLoader * class loader to use for running tests * @param log * logger for the test run * * @return {@code true} if all tests passed */ public boolean runTests(File testCompilationFolder, URLClassLoader classLoader, Log log) { // Get all JUnit tests JunitTestClassDetector detector = new JunitTestClassDetector(); List<JunitTestClassVisitor> testClasses = detector.findTestClasses(testCompilationFolder); List<String> testClassNames = new ArrayList<String>(); if (!testClasses.isEmpty()) { for (JunitTestClassVisitor testClass : testClasses) { testClassNames.add(testClass.getClassName().replaceAll("\\/", ".")); } return runJunitTests(classLoader, testClassNames, log); } else { log.warn(String.format("No JUnit test classes found in %s", testCompilationFolder.getAbsolutePath())); // No tests. Claim they successfully ran anyway. return true; } }