io.vertx.core.logging.LoggerFactory.getLogger()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中io.vertx.core.logging.LoggerFactory.getLogger()方法的一些代码示例,展示了LoggerFactory.getLogger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LoggerFactory.getLogger()方法的具体详情如下:
包路径:io.vertx.core.logging.LoggerFactory
类名称:LoggerFactory
方法名:getLogger

LoggerFactory.getLogger介绍

暂无

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * @deprecated see https://github.com/eclipse-vertx/vert.x/issues/2774
 */
@Deprecated
public static Logger getLogger(final Class<?> clazz) {
 String name = clazz.isAnonymousClass() ?
  clazz.getEnclosingClass().getCanonicalName() :
  clazz.getCanonicalName();
 return getLogger(name);
}

代码示例来源:origin: eclipse-vertx/vert.x

static ResolverProvider factory(Vertx vertx, AddressResolverOptions options) {
 // For now not really plugable, we just want to not fail when we can't load the async provider
 // that use an unstable API and fallback on the default (blocking) provider
 try {
  if (!Boolean.getBoolean(DISABLE_DNS_RESOLVER_PROP_NAME)) {
   return new DnsResolverProvider((VertxImpl) vertx, options);
  }
 } catch (Throwable e) {
  if (e instanceof VertxException) {
   throw e;
  }
  Logger logger = LoggerFactory.getLogger(ResolverProvider.class);
  logger.info("Using the default address resolver as the dns resolver could not be loaded");
 }
 return new DefaultResolverProvider();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public void run() {
  LoggerFactory.getLogger(getClass()).info("I'm inside anonymous class");
}

代码示例来源:origin: eclipse-vertx/vert.x

TestLocationAwareLogger(String name) {
 Logger logger = LoggerFactory.getLogger(name);
 SLF4JLogDelegate delegate = (SLF4JLogDelegate) logger.getDelegate();
 this.actual = (org.slf4j.Logger) delegate.unwrap();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testWarning() {
 testWarning(LoggerFactory.getLogger("my-slf4j-logger"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testWarningLocationAware() {
 testWarning(LoggerFactory.getLogger("my-slf4j-logger"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testInfo() {
 testInfo(LoggerFactory.getLogger("my-slf4j-logger"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testError() {
 testError(LoggerFactory.getLogger("my-slf4j-logger"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testErrorLocationAware() {
 testError(LoggerFactory.getLogger("my-slf4j-logger"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testMethodName() {
 Logger logger = LoggerFactory.getLogger("my-log4j2-logger");
 String result = recording.execute(new Runnable() {
  @Override
  public void run() {
   logger.warn("hello");
  }
 });
 assertTrue(result.contains(".run:"));
}

代码示例来源:origin: eclipse-vertx/vert.x

BareCommand.getTerminationRunnable(vertx, LoggerFactory.getLogger("foo"), () -> asv.set(true)).run();

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testDelegateUnwrap() {
 Logger logger = LoggerFactory.getLogger("my-jul-logger");
 LogDelegate delegate = logger.getDelegate();
 assertNotNull("Delegate is null", delegate);
 try {
  java.util.logging.Logger unwrapped = (java.util.logging.Logger) delegate.unwrap();
  assertNotNull("Unwrapped is null", unwrapped);
 } catch (ClassCastException e) {
  fail("Unexpected unwrapped type: " + e.getMessage());
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testDelegateUnwrap() {
 Logger logger = LoggerFactory.getLogger("my-slf4j-logger");
 LogDelegate delegate = logger.getDelegate();
 assertNotNull("Delegate is null", delegate);
 try {
  org.slf4j.Logger unwrapped = (org.slf4j.Logger) delegate.unwrap();
  assertNotNull("Unwrapped is null", unwrapped);
 } catch (ClassCastException e) {
  fail("Unexpected unwrapped type: " + e.getMessage());
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testDelegateUnwrap() {
 Logger logger = LoggerFactory.getLogger("my-log4j2-logger");
 LogDelegate delegate = logger.getDelegate();
 assertNotNull("Delegate is null", delegate);
 try {
  org.apache.logging.log4j.Logger unwrapped = (org.apache.logging.log4j.Logger) delegate.unwrap();
  assertNotNull("Unwrapped is null", unwrapped);
 } catch (ClassCastException e) {
  fail("Unexpected unwrapped type: " + e.getMessage());
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testError() {
 String result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("hello");
 });
 assertTrue(result.contains("hello"));
 result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("exception", new NullPointerException());
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("hello {0} and {1}", "Paulo", "Julien");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("hello {0}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("hello {0} - {1}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("hello {0}", "vert.x", "foo");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.error("{0}, an exception has been thrown", new IllegalStateException(), "Luke");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testWarning() {
 String result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("hello");
 });
 assertTrue(result.contains("hello"));
 result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("exception", new NullPointerException());
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("hello {0} and {1}", "Paulo", "Julien");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("hello {0}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("hello {0} - {1}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("hello {0}", "vert.x", "foo");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.warn("{0}, an exception has been thrown", new IllegalStateException(), "Luke");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testInfo() {
 String result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("hello");
 });
 assertTrue(result.contains("hello"));
 result = recording.execute(() -> {
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("exception", new NullPointerException());
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("hello {0} and {1}", "Paulo", "Julien");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("hello {0}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("hello {0} - {1}", "vert.x");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("hello {0}", "vert.x", "foo");
 });
  Logger logger = LoggerFactory.getLogger("my-jul-logger");
  logger.info("{0}, an exception has been thrown", new IllegalStateException(), "Luke");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testError() {
 Logger logger = LoggerFactory.getLogger("my-log4j2-logger");
 String result = recording.execute(() -> {
  logger.error("hello");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testWarning() {
 Logger logger = LoggerFactory.getLogger("my-log4j2-logger");
 String result = recording.execute(() -> {
  logger.warn("hello");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testInfo() {
 Logger logger = LoggerFactory.getLogger("my-log4j2-logger");
 String result = recording.execute(() -> {
  logger.info("hello");

相关文章