List of usage examples for org.apache.commons.logging Log info
void info(Object message);
From source file:hotbeans.support.FileSystemHotBeanModuleRepository.java
/** * Reverts an hot beans module to a previous revision (which becomes a new revision). *//*from w ww . j a va2s .c o m*/ public HotBeanModuleInfo revertHotBeanModule(final String moduleName, final long revision) { Log logger = this.getLog(); HotBeanModuleInfo hotBeanModuleInfo = null; if (logger.isInfoEnabled()) logger.info("Attempting to revert module '" + moduleName + "' to revision " + revision + "."); synchronized (super.getLock()) { File moduleDirectory = new File(this.moduleRepositoryDirectory, moduleName); File moduleFile = new File(moduleDirectory, revision + MODULE_FILE_SUFFIX); if (moduleFile.exists()) { try { hotBeanModuleInfo = this.updateModuleInternal(moduleName, new FileInputStream(moduleFile), false); if (logger.isInfoEnabled()) logger.info("Done reverting module - " + hotBeanModuleInfo + "."); } catch (Exception e) { logger.error("Error reverting module '" + moduleName + " - " + e + "'!", e); throw new HotBeansException("Error reverting module '" + moduleName + " - " + e + "'!"); } } else throw new HotBeansException( "Revision " + revision + " doesn't exist for module '" + moduleName + "!"); } if (hotBeanModuleInfo != null) return hotBeanModuleInfo.getClone(); else return hotBeanModuleInfo; }
From source file:com.acciente.induction.template.FreemarkerTemplatingEngine.java
public FreemarkerTemplatingEngine(Config.Templating oConfig, ClassLoader oClassLoader, ServletConfig oServletConfig) throws IOException, ClassNotFoundException { Log oLog; oLog = LogFactory.getLog(FreemarkerTemplatingEngine.class); _oConfiguration = new Configuration(); // set up the template loading path List oTemplateLoaderList = new ArrayList(oConfig.getTemplatePath().getList().size()); for (Iterator oIter = oConfig.getTemplatePath().getList().iterator(); oIter.hasNext();) { Object oLoaderPathItem = oIter.next(); if (oLoaderPathItem instanceof Config.Templating.TemplatePath.Dir) { Config.Templating.TemplatePath.Dir oDir = (Config.Templating.TemplatePath.Dir) oLoaderPathItem; if (!oDir.getDir().exists()) { oLog.warn("freemarker > template load path > ignoring missing directory > " + oDir.getDir()); } else { oLog.info("freemarker > template load path > adding directory > " + oDir.getDir()); oTemplateLoaderList.add(new FileTemplateLoader(oDir.getDir())); }// w w w. j ava2s . c o m } else if (oLoaderPathItem instanceof Config.Templating.TemplatePath.LoaderClass) { Config.Templating.TemplatePath.LoaderClass oLoaderClass = (Config.Templating.TemplatePath.LoaderClass) oLoaderPathItem; Class oClass = Class.forName(oLoaderClass.getLoaderClassName()); oLog.info("freemarker > template load path > adding class > " + oLoaderClass.getLoaderClassName() + ", prefix: " + oLoaderClass.getPath()); oTemplateLoaderList.add(new ClassTemplateLoader(oClass, oLoaderClass.getPath())); } else if (oLoaderPathItem instanceof Config.Templating.TemplatePath.WebappPath) { Config.Templating.TemplatePath.WebappPath oWebappPath = (Config.Templating.TemplatePath.WebappPath) oLoaderPathItem; oLog.info("freemarker > template load path > adding webapp path > " + oWebappPath.getPath()); oTemplateLoaderList .add(new WebappTemplateLoader(oServletConfig.getServletContext(), oWebappPath.getPath())); } else { throw new IllegalArgumentException( "Unexpected template path type in configuration: " + oLoaderPathItem.getClass()); } } TemplateLoader[] oTemplateLoaderArray = new TemplateLoader[oTemplateLoaderList.size()]; oTemplateLoaderList.toArray(oTemplateLoaderArray); _oConfiguration.setTemplateLoader(new MultiTemplateLoader(oTemplateLoaderArray)); // next set the object wrapper handler DefaultObjectWrapper oDefaultObjectWrapper = new DefaultObjectWrapper(); // should publics fields in views be available in the templates oDefaultObjectWrapper.setExposeFields(oConfig.isExposePublicFields()); oLog.info("freemarker > expose public fields > " + oConfig.isExposePublicFields()); _oConfiguration.setObjectWrapper(oDefaultObjectWrapper); if (oConfig.getLocale() != null) { _oConfiguration.setLocale(oConfig.getLocale()); oLog.info("freemarker > using configured locale > " + oConfig.getLocale()); } else { oLog.warn("freemarker > no locale configured, using default > " + _oConfiguration.getLocale()); } }
From source file:de.tudarmstadt.ukp.clarin.webanno.crowdflower.NamedEntityTaskManager.java
/** * Set apiKey to the underlying Crowdclient which manages the crowdflower.com REST-protocol * * @param key - API key as string/*from w w w . j ava 2 s .co m*/ */ public void setAPIKey(String key) { Log LOG = LogFactory.getLog(getClass()); LOG.info("Using apiKey:" + key); crowdclient.setApiKey(key); }
From source file:de.tudarmstadt.ukp.clarin.webanno.crowdflower.NamedEntityTaskManager.java
/** * Helper function for uploadNewNERTask2 and retrieveAggJudgmentsTask2 that retrieves the raw * judgments for the supplied ID and returns a buffered reader for it. * * @param jobID//w w w . java 2 s . c o m * @return Buffered reader for raw judgment data (unzipped) * @throws UnsupportedEncodingException * @throws IOException * @throws CrowdException */ private BufferedReader getReaderForRawJudgments(String jobID) throws UnsupportedEncodingException, IOException, CrowdException { Log LOG = LogFactory.getLog(getClass()); LOG.info("Retrieving data for job: " + jobID); // Retrieve job data CrowdJob job = crowdclient.retrieveJob(jobID); LOG.info("Retrieving raw judgments for job: " + jobID); // Rawdata is a multiline JSON file String rawdata = crowdclient.retrieveRawJudgments(job); // This may happen if the server didn't have enough time to prepare the data. // (Usually the case for anything else than toy datasets) if (rawdata == null || rawdata.equals("")) { throw new CrowdException("No data retrieved for task1 at #" + jobID + ". Crowdflower might need more time to prepare your data, try again in one minute."); } LOG.info("Got " + rawdata.length() + " chars"); StringReader reader = new StringReader(rawdata); BufferedReader br = new BufferedReader(reader); return br; }
From source file:de.tudarmstadt.ukp.clarin.webanno.crowdflower.NamedEntityTaskManager.java
/** * Upload a new NER task1 (German) to crowdflower.com. This method is called from the crowd page * and is the starting point for a new task1 upload. * * @param template - template as string to be used to upload the job * @param documentsJCas - list of source documents to be annotated * @param goldsJCas - gold data which should be used * @param useSents - number of sentences to use * @param useGoldSents - number of gold sentences to use * @return the job ID./* w ww . j a va 2s.co m*/ * @throws JsonProcessingException hum? * @throws IOException hum? * @throws Exception hum? */ public String uploadNewNERTask1(String template, List<JCas> documentsJCas, List<JCas> goldsJCas, int useSents, int useGoldSents) throws JsonProcessingException, IOException, Exception { Log LOG = LogFactory.getLog(getClass()); LOG.info("Creating new Job for Ner task 1."); CrowdJob job = createJob(template); LOG.info("Done, new job id is: " + job.getId() + ". Now generating data for NER task 1"); setAllowedCountries(job); crowdclient.updateAllowedCountries(job); int goldOffset = 0; List<NamedEntityTask1Data> goldData = new ArrayList<NamedEntityTask1Data>(); // If we have gold data, than generate data for it if (goldsJCas != null && goldsJCas.size() > 0) { LOG.info("Gold data available, generating gold data first."); goldData = generateTask1Data(goldsJCas, 0, true, useGoldSents); //Gold offset is measured in tokens goldOffset = this.lastGoldOffset; } LOG.info("Generate normal task data."); List<NamedEntityTask1Data> data = generateTask1Data(documentsJCas, goldOffset, false, useSents); List<NamedEntityTask1Data> mergedData = new ArrayList<NamedEntityTask1Data>(); if (goldsJCas != null && goldsJCas.size() > 0) { mergedData.addAll(goldData); } mergedData.addAll(data); LOG.info("Job data prepared, starting upload."); LOG.info("Uploading data to job #" + job.getId()); crowdclient.uploadData(job, mergedData); LOG.info("Done, finished uploading data to #" + job.getId()); return job.getId(); }
From source file:net.fenyo.mail4hotspot.service.AdvancedServicesImpl.java
@Override public void testLog() { final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(getClass()); log.trace("testlog: TRACE"); log.fatal("testlog: FATAL"); log.error("testlog: ERROR"); log.info("testlog: INFO"); log.debug("testlog: DEBUG"); log.warn("testlog: WARN"); }
From source file:eu.finesce.emarketplace.test.ConnectivityTest.java
/** * Test./*from w w w.j ava2 s.com*/ */ @Test public void test() { // SslConfigurator sslConfig = SslConfigurator.newInstance() // .securityProtocol("SSL"); // SSLContext sslContext = sslConfig.createSSLContext(); // Client client = ClientBuilder.newBuilder().sslContext(sslContext).build(); Log logger = LogFactory.getLog(ContractManagerProxy.class); // Properties prop = new Properties(); // try { // prop.load(this.getClass().getClassLoader() // .getResourceAsStream("config.properties")); // // logger.info("APPLICATION PATH: " + prop.getProperty("application_path")); // } catch (IOException e) { // e.printStackTrace(); // } // // WebTarget webTarget = client.target(prop.getProperty("application_path")); // WebTarget resourceWebTarget = webTarget.path("meterRegistration"); // resourceWebTarget.register(HttpAuthenticationFeature.basic( // prop.getProperty("username"), prop.getProperty("password"))); // Response responseEntity = resourceWebTarget.request( // MediaType.APPLICATION_XML).get(); // // logger.info(responseEntity.readEntity(Meter.class)); // logger.info("test ok"); }
From source file:com.acc.web.manager.LogManager.java
private void log(Object logTypeObject, Object prefixObject, Object informationObject, LogType logType) { if (!AppLibConstant.isUseLog()) { return;/* www. j a va 2 s . c o m*/ } Log log = logType == LogType.SYSTEMOUT || logType == LogType.FILE ? null : this.getLogger(logTypeObject); String logString = this.getLogString(prefixObject, informationObject); switch (logType) { case SYSTEMOUT: super.systemOut(logString); break; case FILE: super.fileOut(logString); break; case INFO: log.info(logString); break; case WARN: log.warn(logString); break; case DEBUG: log.debug(logString); break; case ERROR: log.error(logString); break; case FATAL: log.fatal(logString); break; } }
From source file:com.amazon.carbonado.repo.indexed.ManagedIndex.java
private long logProgress(long nextReportTime, Log log, long totalProgress, int bufferSize, long totalInserted, long totalUpdated, long totalDeleted) { long now = System.currentTimeMillis(); if (now >= nextReportTime) { if (log.isInfoEnabled()) { String format = "Index build progress: %.3f%% " + progressSubMessgage(totalInserted, totalUpdated, totalDeleted); double percent = 100.0 * totalProgress / bufferSize; log.info(String.format(format, percent)); }/*from w w w . j a v a 2s . c om*/ nextReportTime = now + BUILD_INFO_DELAY_MILLIS; } return nextReportTime; }
From source file:com.netspective.axiom.sql.QueryExecutionLogEntry.java
public void finalize(ValueContext vc, Log log) { if (!log.isInfoEnabled()) return;/* ww w .j a v a 2 s .c om*/ StringBuffer info = new StringBuffer(); info.append(identifier); info.append(FIELD_SEPARATOR); info.append(successful ? 1 : 0); info.append(FIELD_SEPARATOR); if (successful) { info.append(getConnEndTime - getConnStartTime); info.append(FIELD_SEPARATOR); info.append(bindParamsEndTime - bindParamsStartTime); info.append(FIELD_SEPARATOR); info.append(execSqlEndTime - execSqlStartTime); info.append(FIELD_SEPARATOR); info.append(execSqlEndTime - initTime); info.append(FIELD_SEPARATOR); } else { info.append(-1); info.append(FIELD_SEPARATOR); info.append(-1); info.append(FIELD_SEPARATOR); info.append(-1); info.append(FIELD_SEPARATOR); info.append(-1); info.append(FIELD_SEPARATOR); } info.append(source); log.info(info.toString()); }