List of usage examples for org.apache.commons.logging Log isInfoEnabled
boolean isInfoEnabled();
From source file:com.CodeSeance.JSeance2.CodeGenXML.Runtime.java
private String run(File templateFile, File includesDir, File modelsDir, File targetDir, TemplateDependencies templateDependencies) { // Create a local logger for the static context Log log = com.CodeSeance.JSeance2.CodeGenXML.Runtime.CreateLogger(Runtime.class); if (log.isInfoEnabled()) { log.info(String.format("Loading Template:[%s]", templateFile.toString())); }//from w ww . ja va 2 s .c o m Template template; try { template = new Template(templateFile); template.loadChildren(template, null); } catch (IOException ex) { throw new RuntimeException(ExecutionError.INVALID_TEMPLATE_FILE.getMessage(templateFile.toString()), ex); } if (log.isInfoEnabled()) { log.info("Template validated"); } // Create a new Context Context context = new Context(includesDir, modelsDir, targetDir, ignoreReadOnlyOuputFiles, templateDependencies); try { // Enter and leave the context on the new template element template.loadAttributes(context); template.onExecutionStart(context); template.onExecutionEnd(context); } finally { // dispose the context manager to release used resources context.dispose(); } return template.getText(); }
From source file:com.CodeSeance.JSeance2.CodeGenXML.Context.java
public void LogInfoMessage(Log log, String tagName, String message) { if (log.isInfoEnabled()) { log.info(String.format("<%s> - %s", tagName, message)); }//from w ww .ja v a2 s.co m }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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 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 w w w . j av a2 s . c om*/ public static Msg info(Log log, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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 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 w w w .j av a2 s. co m*/ public static Msg info(Log log, Locale locale, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(locale, key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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. * * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p> * * @param log the log where the messages will go * @param throwable the throwable associated with the log message * @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 www.j av a 2 s . c o m public static Msg info(Log log, Throwable throwable, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(key, varargs); logInfoWithThrowable(log, key, msg, throwable); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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 w ww. j a va 2 s . co m*/ public static Msg info(Log log, BundleBaseName basename, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(basename, key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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. * * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p> * * @param log the log where the messages will go * @param throwable the throwable associated with the log message * @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 w ww.ja va 2 s .c o m public static Msg info(Log log, Throwable throwable, Locale locale, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(locale, key, varargs); logInfoWithThrowable(log, key, msg, throwable); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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 *//* w w w . j a va 2s .c om*/ public static Msg info(Log log, BundleBaseName basename, Locale locale, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(basename, locale, key, varargs); log.info((Logger.getDumpLogKeys()) ? ('{' + key + '}' + msg) : msg); return msg; } return null; }
From source file:com.sos.i18n.logging.commons.CommonsLogMsg.java
/** * Logs the given message to the log at the info 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. * * <p>The given Throwable will be passed to the logger so its stack can be dumped when appropriate.</p> * * @param log the log where the messages will go * @param throwable the throwable associated with the log message * @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 w w w . j a v a 2 s . com public static Msg info(Log log, Throwable throwable, BundleBaseName basename, String key, Object... varargs) { if (log.isInfoEnabled()) { Msg msg = Msg.createMsg(basename, key, varargs); logInfoWithThrowable(log, key, msg, throwable); return msg; } return null; }
From source file:gov.nih.nci.cabig.caaers.tools.logging.CaaersLoggingAspect.java
@Around("execution(public * gov.nih.nci.cabig.caaers.api.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.api.impl.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.dao..*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.domain.repository.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.domain.repository.ajax.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.service..*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.validation..*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.workflow..*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.rules.business.service.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.rules.runtime.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.web.ae.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.web.study.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.web.admin.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.web.rule.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.web.participant.*.*(..))" + "|| execution(public * gov.nih.nci.cabig.caaers.tools.Excel*.*(..))") public Object log(ProceedingJoinPoint call) throws Throwable { Log logger = (call.getTarget() == null) ? LogFactory.getLog(CaaersLoggingAspect.class) : LogFactory.getLog(call.getTarget().getClass()); //just proceed to call if Info is not enabled. if (logger == null || !logger.isInfoEnabled()) return call.proceed(); boolean traceEnabled = logger.isTraceEnabled(); String userName = ""; if (traceEnabled) { userName = "[" + getUserLoginName() + "] - "; log(logger, true, call, null, 0, userName); }/*from w w w .j a v a2s .c o m*/ long startTime = System.currentTimeMillis(); //proceed with the call Object point = call.proceed(); long endTime = System.currentTimeMillis(); long executionTime = (endTime - startTime); if (executionTime > 500) { logger.info(userName + "More than 500ms [ " + call.toShortString() + " executionTime : " + executionTime + "]"); } if (traceEnabled) { log(logger, false, call, point, executionTime, userName); } return point; }