List of usage examples for org.apache.commons.logging Log warn
void warn(Object message);
From source file:com.lucidtechnics.blackboard.util.error.ErrorManager.java
public void warnException(Throwable _throwable, Log _logger) { PrintWriter printWriter = null; StringWriter stringWriter = null; try {/*from ww w. j a v a2 s .c om*/ _logger.warn("Encountered exception with message: " + _throwable.getMessage()); _logger.warn("WITH JAVA STACK TRACE:\n"); stringWriter = new StringWriter(); printWriter = new PrintWriter(stringWriter); _throwable.printStackTrace(printWriter); _logger.error(stringWriter.toString()); } catch (Exception e) { } finally { if (stringWriter != null) { try { stringWriter.close(); } catch (Exception e) { } } if (printWriter != null) { try { printWriter.close(); } catch (Exception e) { } } } }
From source file:net.java.dev.weblets.impl.servlets.WebletResponseImpl.java
private void setResponseStatus(int status) { if (_httpResponse instanceof HttpServletResponse) { ((HttpServletResponse) _httpResponse).setStatus(status); return;/* ww w . ja v a 2 s.co m*/ } Method[] supportedMethods = _httpResponse.getClass().getMethods(); // fetch the date header method Method m = null; try { m = _httpResponse.getClass().getMethod("setStatus", new Class[] { int.class }); } catch (NoSuchMethodException e) { if (!responsestatus_warn) { responsestatus_warn = true; Log log = LogFactory.getLog(getClass()); log.warn("No satus setting possible reason: "); log.warn(e); return; } } try { Object[] params = new Object[1]; params[0] = new Integer(status); m.invoke(_httpResponse, params); } catch (IllegalAccessException e) { Log log = LogFactory.getLog(getClass()); log.error(e); } catch (InvocationTargetException e) { Log log = LogFactory.getLog(getClass()); log.error(e); } return; }
From source file:net.java.dev.weblets.impl.servlets.WebletResponseImpl.java
/** * we fallback to various introspection methods to support portlet environments as well * * @param entry//from w w w . j a v a2 s.co m * @param lastModified */ private void setDateHeader(String entry, long lastModified) { /*we can cover a simple httpservletresponse*/ /*we do it that way to improve speed*/ if (_httpResponse instanceof HttpServletResponse) { ((HttpServletResponse) _httpResponse).addDateHeader(entry, lastModified); return; } /*with others we give introspection a try*/ Method[] supportedMethods = _httpResponse.getClass().getMethods(); // fetch the date header method Method m = null; try { m = _httpResponse.getClass().getMethod(SETDATEHEADER, new Class[] { String.class, long.class }); } catch (NoSuchMethodException e) { if (!_dateheader_warn) { _dateheader_warn = true; // we do not want to flood warnings one is enough Log log = LogFactory.getLog(getClass()); log.warn(ERR_NODATEHEADERSET); log.warn(e); return; } } try { Object[] params = new Object[2]; params[0] = entry; params[1] = new Long(lastModified); m.invoke(_httpResponse, params); } catch (IllegalAccessException e) { Log log = LogFactory.getLog(getClass()); log.error(e); } catch (InvocationTargetException e) { Log log = LogFactory.getLog(getClass()); log.error(e); } return; }
From source file:com.kappaware.logtrawler.ipmatcher.IpMatcherImpl.java
@Override public boolean matchWithLog(String ipAddress, Log log) { if (log == null) { log = matcherLog;/* w ww. ja v a 2 s. c o m*/ } if (this.match(ipAddress)) { return true; } else { log.warn("Remote IP '" + ipAddress + "' does not match any segment in range '" + range + "'"); return false; } }
From source file:com.taobao.tddl.common.DynamicLog.java
public void warn(String key, Object[] args, String defaultLog, Log log) { String content = build(key, args, defaultLog); if (content != null && !"".equals(content)) { log.warn(content); }// w ww . j a va 2 s . c om }
From source file:es.caib.seycon.ng.servei.ConfiguracioServiceImpl.java
/** * Method that implements the functionality to reconfigure NAS. * @param configuracio/* ww w. j a v a 2 s . co m*/ * @throws InstantiationException * @throws IllegalAccessException * @throws ClassNotFoundException * @throws NASException */ private void reconfigureNAS(Configuracio configuracio) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NASException { try { if (checkAllConfigurationSet(configuracio)) { NASManager.getInstance(); NASManager.loadConfiguration(); } } catch (NASException ex) { Log log = LogFactory.getLog(getClass()); log.warn(String.format("Document manager: parameter not defined: %1$s", //$NON-NLS-1$ configuracio.getCodi())); } }
From source file:com.dotosoft.dot4command.impl.CatalogFactoryBase.java
public <CMD extends Command<K, V, C>> CMD getCommand(String commandID) { String commandName = commandID; String catalogName = null;/*from w w w . j av a2 s . c o m*/ Catalog<K, V, C> catalog; if (commandID != null) { int splitPos = commandID.indexOf(DELIMITER); if (splitPos != -1) { catalogName = commandID.substring(0, splitPos); commandName = commandID.substring(splitPos + DELIMITER.length()); if (commandName.contains(DELIMITER)) { throw new IllegalArgumentException( "commandID [" + commandID + "] has too many delimiters (reserved for future use)"); } } } if (catalogName != null) { catalog = this.getCatalog(catalogName); if (catalog == null) { Log log = LogFactory.getLog(CatalogFactoryBase.class); log.warn("No catalog found for name: " + catalogName + "."); return null; } } else { catalog = this.getCatalog(); if (catalog == null) { Log log = LogFactory.getLog(CatalogFactoryBase.class); log.warn("No default catalog found."); return null; } } return catalog.<CMD>getCommand(commandName); }
From source file:dk.netarkivet.common.utils.batch.EvilPostProcessingJob.java
@Override public boolean postProcess(InputStream input, OutputStream output) { Log log = LogFactory.getLog(this.getClass()); try {// w ww . j a va2 s.c o m File[] files = FileUtils.getTempDir().listFiles(); log.info("directory batch contains " + files.length + " files."); for (File fil : files) { log.warn("deleting: " + fil.getName()); fil.delete(); } return true; } catch (Exception e) { log.warn(e.getMessage()); return false; } }
From source file:net.sourceforge.dita4publishers.impl.bos.BosConstructionOptions.java
private void initGrammarPool(Log log) { try {//from ww w . j a va 2 s . c o m this.grammarPool = new XMLGrammarPoolImpl(); } catch (Exception e) { log.warn("Failed to create Xerces grammar pool for caching DTDs and schemas"); } }
From source file:net.sf.nmedit.nordmodular.NmFileService.java
public void newFile() { try {/*from w w w . j av a 2s. com*/ NMPatch patch = new NMPatch(NMData.sharedInstance().getModuleDescriptions()); PatchDocument pd = createPatchDoc(patch); Nomad.sharedInstance().getDocumentManager().add(pd); patch.setEditSupportEnabled(true); // enable history } catch (Exception e) { Log log = LogFactory.getLog(getClass()); if (log.isWarnEnabled()) { log.warn(e); } return; } }