本文整理了Java中com.metamx.common.logger.Logger.error()
方法的一些代码示例,展示了Logger.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()
方法的具体详情如下:
包路径:com.metamx.common.logger.Logger
类名称:Logger
方法名:error
[英]Protect against assuming slf4j convention. use error(Throwable t, String message, Object... formatArgs)
instead
[中]防止采用slf4j公约。使用“error(Throwable t,String message,Object…formatArgs)`代替
代码示例来源:origin: com.n3twork.druid/druid-server
@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);
}
});
代码示例来源:origin: com.metamx/java-util
public static void close(Closeable closeable)
{
if (closeable == null) {
return;
}
try {
closeable.close();
}
catch (IOException e) {
log.error(e, "IOException thrown while closing Closeable.");
}
}
}
代码示例来源:origin: metamx/java-util
public static void close(Closeable closeable)
{
if (closeable == null) {
return;
}
try {
closeable.close();
}
catch (IOException e) {
log.error(e, "IOException thrown while closing Closeable.");
}
}
}
代码示例来源:origin: com.metamx/java-util
@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());
}
}
}
代码示例来源:origin: metamx/java-util
@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());
}
}
}
代码示例来源:origin: com.n3twork.druid/druid-indexing-service
@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();
}
代码示例来源:origin: com.metamx/java-util
@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.");
}
}
},
代码示例来源:origin: com.metamx/java-util
@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);
}
}
}
}
}
代码示例来源:origin: metamx/java-util
@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.");
}
}
},
代码示例来源:origin: com.metamx/java-util
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()
);
}
}
代码示例来源:origin: metamx/java-util
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()
);
}
}
代码示例来源:origin: com.n3twork.druid/druid-server
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());
}
}
代码示例来源:origin: metamx/java-util
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()
);
}
}
}
代码示例来源:origin: com.n3twork.druid/druid-server
@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();
}
}
代码示例来源:origin: com.metamx/java-util
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");
}
}
代码示例来源:origin: com.metamx/server-metrics
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");
}
}
代码示例来源:origin: metamx/java-util
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");
}
}
代码示例来源:origin: com.n3twork.druid/server-metrics
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");
}
}
代码示例来源:origin: com.n3twork.druid/druid-indexing-service
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;
}
}
代码示例来源:origin: metamx/java-util
@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);
}
}
内容来源于网络,如有侵权,请联系作者删除!