本文整理匯總了Java中org.apache.logging.log4j.core.Logger.info方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.info方法的具體用法?Java Logger.info怎麽用?Java Logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.logging.log4j.core.Logger
的用法示例。
在下文中一共展示了Logger.info方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAfterSetProperties
import org.apache.logging.log4j.core.Logger; //導入方法依賴的package包/類
@Test
public void testAfterSetProperties() throws Exception {
System.setProperty(PROPERTY1, PROPERTY1_VALUE);
System.setProperty(PROPERTY2, PROPERTY2_VALUE);
setup();
Logger logger = loggerContext.getLogger(getClass().getName());
logger.info(LOG_MESSAGE);
assertThat(GelfTestSender.getMessages()).hasSize(1);
GelfMessage gelfMessage = GelfTestSender.getMessages().get(0);
assertThat(gelfMessage.getField("propertyField1")).isEqualTo(System.getProperty("user.language"));
assertThat(gelfMessage.getField("propertyField2")).isEqualTo(PROPERTY1_VALUE);
assertThat(gelfMessage.getField("propertyField3")).isEqualTo("${sys:otherproperty:fallback}");
assertThat(gelfMessage.getField("propertyField4")).isEqualTo("embedded" + PROPERTY1_VALUE + "property");
}
示例2: testClientServer
import org.apache.logging.log4j.core.Logger; //導入方法依賴的package包/類
@Test(timeout = DEFAULT_TIMEOUT_MILLIS)
public void testClientServer() throws Exception {
final JeroMqAppender appender = ctx.getRequiredAppender(APPENDER_NAME, JeroMqAppender.class);
final int expectedReceiveCount = 3;
final JeroMqTestClient client = new JeroMqTestClient(JeroMqManager.getContext(), ENDPOINT, expectedReceiveCount);
final ExecutorService executor = Executors.newSingleThreadExecutor();
try {
final Future<List<String>> future = executor.submit(client);
Thread.sleep(100);
final Logger logger = ctx.getLogger(getClass().getName());
appender.resetSendRcs();
logger.info("Hello");
logger.info("Again");
ThreadContext.put("foo", "bar");
logger.info("World");
final List<String> list = future.get();
Assert.assertEquals(expectedReceiveCount, appender.getSendRcTrue());
Assert.assertEquals(0, appender.getSendRcFalse());
Assert.assertEquals("Hello", list.get(0));
Assert.assertEquals("Again", list.get(1));
Assert.assertEquals("barWorld", list.get(2));
} finally {
executor.shutdown();
}
}
示例3: testDefaults
import org.apache.logging.log4j.core.Logger; //導入方法依賴的package包/類
@Test
public void testDefaults() throws Exception {
Logger logger = loggerContext.getLogger(getClass().getName());
logger.info(LOG_MESSAGE);
assertThat(GelfTestSender.getMessages()).hasSize(1);
GelfMessage gelfMessage = GelfTestSender.getMessages().get(0);
assertThat(gelfMessage.getField("propertyField1")).isEqualTo(System.getProperty("user.language"));
assertThat(gelfMessage.getField("propertyField2")).isEqualTo("${sys:myproperty}");
assertThat(gelfMessage.getField("propertyField3")).isEqualTo("${sys:otherproperty:fallback}");
assertThat(gelfMessage.getField("propertyField4")).isEqualTo("embedded${sys:myproperty}property");
}
示例4: testServerOnly
import org.apache.logging.log4j.core.Logger; //導入方法依賴的package包/類
@Test(timeout = DEFAULT_TIMEOUT_MILLIS)
public void testServerOnly() throws Exception {
final Logger logger = ctx.getLogger(getClass().getName());
final JeroMqAppender appender = ctx.getRequiredAppender(APPENDER_NAME, JeroMqAppender.class);
appender.resetSendRcs();
logger.info("Hello");
logger.info("Again");
Assert.assertEquals(2, appender.getSendRcTrue());
Assert.assertEquals(0, appender.getSendRcFalse());
}
示例5: append
import org.apache.logging.log4j.core.Logger; //導入方法依賴的package包/類
private static void append(Logger logger, String message) {
LOGGER.debug("trying to append: %s", message);
logger.info(message);
}