@Override public void onFailure(Exception e) { log.error(e, "Unable to connect to irc server [%s]", host); throw new RuntimeException("Unable to connect to server", e); } });
public static void close(Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException e) { log.error(e, "IOException thrown while closing Closeable."); } } }
public static void close(Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException e) { log.error(e, "IOException thrown while closing Closeable."); } } }
@Override public void stop() { log.info("Stopping object[%s]", o); try { stopMethod.invoke(o); } catch (Exception e) { log.error(e, "Unable to invoke stopMethod() on %s", o.getClass()); } } }
@Override public void stop() { log.info("Stopping object[%s]", o); try { stopMethod.invoke(o); } catch (Exception e) { log.error(e, "Unable to invoke stopMethod() on %s", o.getClass()); } } }
@POST @Path("/task/{taskid}/shutdown") @Produces("application/json") public Response doShutdown(@PathParam("taskid") String taskid) { try { taskRunner.shutdown(taskid); } catch (Exception e) { log.error(e, "Failed to issue shutdown for task: %s", taskid); return Response.serverError().build(); } return Response.ok(ImmutableMap.of("task", taskid)).build(); }
@Override public void run() { if (prevSignal == null || prevSignal == Signal.REPEAT) { exec.schedule(this, rate.getMillis(), TimeUnit.MILLISECONDS); } try { log.debug("Running %s (period %s)", callable, rate); prevSignal = callable.call(); } catch(Throwable e) { log.error(e, "Uncaught exception."); } } },
@Override public void stop() { for (Method method : o.getClass().getMethods()) { if (method.getAnnotation(LifecycleStop.class) != null) { log.info("Invoking stop method[%s] on object[%s].", method, o); try { method.invoke(o); } catch (Exception e) { log.error(e, "Exception when stopping method[%s] on object[%s]", method, o); } } } } }
@Override public void run() { if (prevSignal == null || prevSignal == Signal.REPEAT) { exec.schedule(this, rate.getMillis(), TimeUnit.MILLISECONDS); } try { log.debug("Running %s (period %s)", callable, rate); prevSignal = callable.call(); } catch(Throwable e) { log.error(e, "Uncaught exception."); } } },
private void limitFailedBuffersSize() { if (failedBuffers.size() >= config.getBatchQueueSizeLimit()) { failedBuffers.removeFirst(); approximateFailedBuffersCount.decrementAndGet(); droppedBuffers.incrementAndGet(); log.error( "failedBuffers queue size reached the limit [%d], dropping the oldest failed buffer", config.getBatchQueueSizeLimit() ); } }
private void limitFailedBuffersSize() { if (failedBuffers.size() >= config.getBatchQueueSizeLimit()) { failedBuffers.removeFirst(); approximateFailedBuffersCount.decrementAndGet(); droppedBuffers.incrementAndGet(); log.error( "failedBuffers queue size reached the limit [%d], dropping the oldest failed buffer", config.getBatchQueueSizeLimit() ); } }
private String getRuleURL() { Server server = selector.pick(); if (server == null) { log.error("No instances found for [%s]!", config.get().getCoordinatorServiceName()); return null; } return String.format("http://%s%s", server.getHost(), config.get().getRulesEndpoint()); } }
private void limitBuffersToEmitSize() { if (approximateBuffersToEmitCount.get() >= config.getBatchQueueSizeLimit()) { Batch droppedBatch = buffersToEmit.pollFirst(); if (droppedBatch != null) { batchFinalized(); approximateBuffersToEmitCount.decrementAndGet(); approximateEventsToEmitCount.addAndGet(-droppedBatch.eventCount.get()); droppedBuffers.incrementAndGet(); log.error( "buffersToEmit queue size reached the limit [%d], dropping the oldest buffer to emit", config.getBatchQueueSizeLimit() ); } } }
@Override public <T> QueryRunner<T> getQueryRunner(DruidServer server) { synchronized (lock) { QueryableDruidServer queryableDruidServer = clients.get(server.getName()); if (queryableDruidServer == null) { log.error("WTF?! No QueryableDruidServer found for %s", server.getName()); return null; } return queryableDruidServer.getClient(); } }
private SwapStats() { try { Swap swap = sigar.getSwap(); this.prevPageIn = swap.getPageIn(); this.prevPageOut = swap.getPageOut(); } catch (SigarException e) { log.error(e, "Failed to get Swap"); } }
private SwapStats() { try { Swap swap = sigar.getSwap(); this.prevPageIn = swap.getPageIn(); this.prevPageOut = swap.getPageOut(); } catch (SigarException e) { log.error(e, "Failed to get Swap"); } }
private SwapStats() { try { Swap swap = sigar.getSwap(); this.prevPageIn = swap.getPageIn(); this.prevPageOut = swap.getPageOut(); } catch (SigarException e) { log.error(e, "Failed to get Swap"); } }
private SwapStats() { try { Swap swap = sigar.getSwap(); this.prevPageIn = swap.getPageIn(); this.prevPageOut = swap.getPageOut(); } catch (SigarException e) { log.error(e, "Failed to get Swap"); } }
private void updatePayload(final Handle handle, final DataSegment segment) throws IOException { try { handle.createStatement( String.format("UPDATE %s SET payload = :payload WHERE id = :id", dbTables.getSegmentsTable()) ) .bind("id", segment.getIdentifier()) .bind("payload", jsonMapper.writeValueAsString(segment)) .execute(); } catch (IOException e) { log.error(e, "Exception inserting into DB"); throw e; } }
@Test public void testLegacyLogging() { final Logger log = new Logger(LoggerTest.class); final Throwable throwable = new Throwable(); // These should show up in an IDE as deprecated, but shouldn't actually fail. log.error("foo", throwable); log.warn("foo", throwable); } }