List of usage examples for org.apache.commons.logging LogFactory getLog
public static Log getLog(String name)
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 {/*from w ww . j a v a 2 s . co 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:fr.aliasource.webmail.pool.Pool.java
public Pool(String poolId, IPoolableObjectFactory<T> factory, int poolSize, String destroyMethodName, long keepAlivePeriod) { this.logger = LogFactory.getLog(getClass()); this.poolId = poolId; this.objectsInUse = Collections.synchronizedSet(new HashSet<T>()); this.destroyMethod = destroyMethodName; this.availableObjects = new LinkedBlockingQueue<T>(poolSize); for (int i = 0; i < poolSize; i++) { logger.info(poolId + ": Adding pooled object..."); availableObjects.add(factory.createNewObject()); logger.info(poolId + ": Pooled object added."); }//w w w . j ava 2 s . c om keepAliveTimer = new Timer(poolId + "-keepalive-timer", true); KeepAliveTask<T> kaTsk = new KeepAliveTask<T>(availableObjects, factory, this); keepAliveTimer.scheduleAtFixedRate(kaTsk, 10000, keepAlivePeriod); }
From source file:net.sf.janos.ui.action.SkipBackAction.java
public void widgetSelected(SelectionEvent e) { SonosControllerShell controllerShell = ApplicationContext.getInstance().getShell(); SonosController controller = ApplicationContext.getInstance().getController(); ZonePlayer zone = controller.getCoordinatorForZonePlayer(controllerShell.getZoneList().getSelectedZone()); try {/*from w w w .j av a2 s . c o m*/ AVTransportService avTransportService = zone.getMediaRendererDevice().getAvTransportService(); avTransportService.previous(); } catch (IOException ex) { LogFactory.getLog(getClass()).error("Could not skip back", ex); } catch (UPNPResponseException ex) { LogFactory.getLog(getClass()).error("Could not skip back", ex); } }
From source file:com.mindquarry.desktop.client.widget.util.IconActionThread.java
public IconActionThread(TrayItem item, Shell shell) { log = LogFactory.getLog(IconActionThread.class); this.shell = shell; this.item = item; this.item.setToolTipText(MindClient.APPLICATION_NAME); // initialize icons icons.put(10, new Image(Display.getCurrent(), getClass().getResourceAsStream(ICON_BASE_PATH + ".png"))); for (int i = 1; i <= 9; i++) { icons.put(i, new Image(Display.getCurrent(), getClass().getResourceAsStream(ICON_BASE_PATH + "-" + i + ".png"))); }/*from ww w . j a v a2s .com*/ }
From source file:com.winvector.logistic.demo.MapReduceScore.java
public double run(final String modelFileName, final String testFileName, final String resultFileName) throws Exception { final Log log = LogFactory.getLog(MapReduceScore.class); final Random rand = new Random(); final String tmpPrefix = "TMPAC_" + rand.nextLong(); final Configuration mrConfig = getConf(); log.info("start"); log.info("reading model: " + modelFileName); final Model model; {//from ww w . ja v a2 s .c o m final Path modelPath = new Path(modelFileName); final FSDataInputStream fdi = modelPath.getFileSystem(mrConfig).open(modelPath); final ObjectInputStream ois = new ObjectInputStream(fdi); model = (Model) ois.readObject(); ois.close(); } log.info("model:\n" + model.config.formatSoln(model.coefs)); final Path testFile = new Path(testFileName); final Path resultFile = new Path(resultFileName); log.info("scoring data: " + testFile); log.info("writing: " + resultFile); final SigmoidLossMultinomial underlying = new SigmoidLossMultinomial(model.config.dim(), model.config.noutcomes()); final WritableVariableList lConfig = WritableVariableList.copy(model.config.def()); final String headerLine = WritableUtils.readFirstLine(mrConfig, testFile); final Pattern sepPattern = Pattern.compile("\t"); final LineBurster burster = new HBurster(sepPattern, headerLine, false); mrConfig.set(MapRedScan.BURSTERSERFIELD, SerialUtils.serializableToString(burster)); final StringBuilder b = new StringBuilder(); b.append("predict" + "." + model.config.def().resultColumn + "\t"); b.append("predict" + "." + model.config.def().resultColumn + "." + "score" + "\t"); for (int i = 0; i < model.config.noutcomes(); ++i) { final String cat = model.config.outcome(i); b.append("predict" + "." + model.config.def().resultColumn + "." + cat + "." + "score" + "\t"); } b.append(headerLine); mrConfig.set(MapRedScore.IDEALHEADERFIELD, b.toString()); final MapRedScore sc = new MapRedScore(underlying, lConfig, model.config.useIntercept(), mrConfig, testFile); sc.score(model.coefs, resultFile); final MapRedAccuracy ac = new MapRedAccuracy(underlying, lConfig, model.config.useIntercept(), tmpPrefix, mrConfig, testFile); final long[] testAccuracy = ac.score(model.coefs); final double accuracy = testAccuracy[0] / (double) testAccuracy[1]; log.info("test accuracy: " + testAccuracy[0] + "/" + testAccuracy[1] + "\t" + accuracy); log.info("done"); return accuracy; }
From source file:fr.aliasource.webmail.proxy.Controller.java
public Controller() { logger = LogFactory.getLog(getClass()); clients = new TimeOutMap<String, IProxy>(6 * 60 * 1000); controlledActions = new HashMap<String, IControlledAction>(); logger.info("Controller created."); }
From source file:fr.aliasource.webmail.indexing.SearchAction.java
public SearchAction() { logger = LogFactory.getLog(getClass()); if (logger.isDebugEnabled()) { logger.debug("SearchAction created."); } }
From source file:core.com.qiniu.internal.SdkInputStream.java
/** * Aborts with subclass specific abortion logic executed if needed. Note the * interrupted status of the thread is cleared by this method. * * @throws AbortedException if found necessary. *///from w w w . ja v a 2 s. c o m protected final void abortIfNeeded() { if (Thread.interrupted()) { try { abort(); // execute subclass specific abortion logic } catch (IOException e) { LogFactory.getLog(getClass()).debug("FYI", e); } throw new AbortedException(); } }
From source file:edu.umich.robot.soar.StopCommand.java
public StopCommand(Identifier wme, SoarAgent agent) { super(wme, agent.getEvents(), LogFactory.getLog(StopCommand.class)); this.output = agent.getRobotOutput(); addEvent(new DriveLinearEvent(0), AbstractDriveEvent.class); addEvent(new DriveAngularEvent(0), AbstractDriveEvent.class); }
From source file:gridool.deployment.GridGetClassTask.java
protected ClassData execute() throws GridException { final Class<?> clazz; try {/*from w w w . j a va2 s . c om*/ clazz = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException e) { String errmsg = "Class not found: " + className; LogFactory.getLog(getClass()).error(errmsg, e); throw new GridException(errmsg, e); } final byte[] b; try { b = ClassUtils.getClassAsBytes(clazz); } catch (IOException e) { String errmsg = "Failed serializing a class: " + clazz.getName(); LogFactory.getLog(getClass()).error(errmsg, e); throw new GridException(errmsg, e); } final long timestamp = ClassUtils.getLastModified(clazz); final ClassData innerClassData = new ClassData(b, timestamp); ClassData classData = innerClassData; Class<?> enclosingClass = clazz.getEnclosingClass(); while (enclosingClass != null) { classData = addEnclosingClass(classData, enclosingClass); enclosingClass = enclosingClass.getEnclosingClass(); } return innerClassData; }