本文整理汇总了Java中org.apache.logging.log4j.Logger.info方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.info方法的具体用法?Java Logger.info怎么用?Java Logger.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.logging.log4j.Logger
的用法示例。
在下文中一共展示了Logger.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPerformanceLogger
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Override
protected PerformanceLogger createPerformanceLogger() throws IOException {
final Logger logger = createLogger();
final PerformanceLogger perfLogger = new PerformanceLogger() {
@Override
public void log(String message) {
logger.info(message);
}
@Override
public boolean isEnabled() {
return logger.isEnabled(Level.INFO);
}
};
return perfLogger;
}
示例2: geodeVerboseShouldNotLogIfGemfireVerboseIsDeny
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
public void geodeVerboseShouldNotLogIfGemfireVerboseIsDeny() {
configureLogging(this.configFileGemfireVerboseDeny);
Logger logger = LogService.getLogger();
String msg = this.testName.getMethodName();
logger.info(LogMarker.GEODE_VERBOSE, msg);
assertThat(this.systemOutRule.getLog()).doesNotContain(msg);
}
示例3: geodeVerboseShouldLogIfGemfireVerboseIsAccept
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
public void geodeVerboseShouldLogIfGemfireVerboseIsAccept() {
configureLogging(this.configFileGemfireVerboseAccept);
Logger logger = LogService.getLogger();
String msg = this.testName.getMethodName();
logger.info(LogMarker.GEODE_VERBOSE, msg);
assertThat(this.systemOutRule.getLog()).contains(msg);
}
示例4: testPrefixLogger
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
public void testPrefixLogger() throws IOException, IllegalAccessException, UserException {
setupLogging("prefix");
final String prefix = randomBoolean() ? null : randomAsciiOfLength(16);
final Logger logger = Loggers.getLogger("prefix", prefix);
logger.info("test");
logger.info("{}", "test");
final Exception e = new Exception("exception");
logger.info(new ParameterizedMessage("{}", "test"), e);
final String path =
System.getProperty("es.logs.base_path") +
System.getProperty("file.separator") +
System.getProperty("es.logs.cluster_name") +
".log";
final List<String> events = Files.readAllLines(PathUtils.get(path));
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
final int stackTraceLength = sw.toString().split(System.getProperty("line.separator")).length;
final int expectedLogLines = 3;
assertThat(events.size(), equalTo(expectedLogLines + stackTraceLength));
for (int i = 0; i < expectedLogLines; i++) {
if (prefix == null) {
assertThat(events.get(i), startsWith("test"));
} else {
assertThat(events.get(i), startsWith("[" + prefix + "] test"));
}
}
}
示例5: isUpgraded
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
public static boolean isUpgraded(Client client, String index) throws Exception {
Logger logger = Loggers.getLogger(OldIndexUtils.class);
int toUpgrade = 0;
for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) {
logger.info("Index: {}, total: {}, toUpgrade: {}", status.getIndex(), status.getTotalBytes(), status.getToUpgradeBytes());
toUpgrade += status.getToUpgradeBytes();
}
return toUpgrade == 0;
}
示例6: test04
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
public void test04() {
Logger logger = LogManager.getLogger();
String name = "李志伟";
Date birthday = new Date();
for (int i = 0; i < 10000; i++) {
logger.debug("次数[{}] 用户名称:[{}], 日期:[{}]", i, name, birthday);
logger.info("次数[{}] 用户名称:[{}], 日期:[{}]", i, name, birthday);
logger.warn("次数[{}] 用户名称:[{}], 日期:[{}]", i, name, birthday);
logger.error("次数[{}] 用户名称:[{}], 日期:[{}]", i, name, birthday);
logger.fatal("次数[{}] 用户名称:[{}], 日期:[{}]", i, name, birthday);
}
LogManager.shutdown();
}
示例7: logFragmentState
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
private void logFragmentState(Logger lw) {
for (Fragment f : this.fragmentList) {
int freeSpace = f.freeSpace();
if (freeSpace > 0) {
lw.info("Fragment at " + f.getAddress() + " of size " + f.getSize() + " has " + freeSpace
+ " bytes free.");
}
}
}
示例8: stop
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
private Node stop() {
if (!lifecycle.moveToStopped()) {
return this;
}
Logger logger = Loggers.getLogger(Node.class, NODE_NAME_SETTING.get(settings));
logger.info("stopping ...");
injector.getInstance(TribeService.class).stop();
injector.getInstance(ResourceWatcherService.class).stop();
if (NetworkModule.HTTP_ENABLED.get(settings)) {
injector.getInstance(HttpServerTransport.class).stop();
}
injector.getInstance(SnapshotsService.class).stop();
injector.getInstance(SnapshotShardsService.class).stop();
// stop any changes happening as a result of cluster state changes
injector.getInstance(IndicesClusterStateService.class).stop();
// close discovery early to not react to pings anymore.
// This can confuse other nodes and delay things - mostly if we're the master and we're running tests.
injector.getInstance(Discovery.class).stop();
// we close indices first, so operations won't be allowed on it
injector.getInstance(RoutingService.class).stop();
injector.getInstance(ClusterService.class).stop();
injector.getInstance(NodeConnectionsService.class).stop();
injector.getInstance(MonitorService.class).stop();
injector.getInstance(GatewayService.class).stop();
injector.getInstance(SearchService.class).stop();
injector.getInstance(TransportService.class).stop();
injector.getInstance(SearchTransportService.class).stop();
pluginLifecycleComponents.forEach(LifecycleComponent::stop);
// we should stop this last since it waits for resources to get released
// if we had scroll searchers etc or recovery going on we wait for to finish.
injector.getInstance(IndicesService.class).stop();
logger.info("stopped");
return this;
}
示例9: initializeLogger
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
public void initializeLogger() {
Logger logger = LogManager.getLogger("elasticsearch");
logger.info("logger started");
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (InterruptedException e) {
interrupted();
}
}
示例10: logOffHeapState
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
void logOffHeapState(Logger lw, int chunkSize) {
OffHeapMemoryStats stats = this.ma.getStats();
lw.info("OutOfOffHeapMemory allocating size of " + chunkSize + ". allocated="
+ this.allocatedSize.get() + " defragmentations=" + this.defragmentationCount.get()
+ " objects=" + stats.getObjects() + " free=" + stats.getFreeMemory() + " fragments="
+ stats.getFragments() + " largestFragment=" + stats.getLargestFragment()
+ " fragmentation=" + stats.getFragmentation());
logFragmentState(lw);
logTinyState(lw);
logHugeState(lw);
}
示例11: handleBlockRegistration
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
/**
* Handles block registration at init.
* @param novousBootstrapLogger
*/
private static void handleBlockRegistration(Logger novousBootstrapLogger) {
novousBootstrapLogger.info("Registering custom blocks...");
PhysicalRegistry.instance().getRegisteredBlocks().forEach((abstractBlock) -> {
Block nativeBlock = new Block(Material.IRON, Material.IRON.getMaterialMapColor()).setUnlocalizedName
(abstractBlock.getUnlocalizedName());
novousBootstrapLogger.info("Registering " + abstractBlock.getRegistryPath() + "...");
Block.REGISTRY.register(abstractBlock.getNumericalId(), new ResourceLocation
(abstractBlock.getRegistryPath().toString()), nativeBlock);
});
}
示例12: gemfireVerboseShouldNotLogIfGeodeVerboseIsAccept
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
/**
* GEMFIRE_VERBOSE is parent of GEODE_VERBOSE so enabling GEODE_VERBOSE does not enable
* GEMFIRE_VERBOSE.
*/
@Test
public void gemfireVerboseShouldNotLogIfGeodeVerboseIsAccept() {
configureLogging(this.configFileGeodeVerboseAccept);
Logger logger = LogService.getLogger();
String msg = this.testName.getMethodName();
logger.info(LogMarker.GEMFIRE_VERBOSE, msg);
assertThat(this.systemOutRule.getLog()).doesNotContain(msg);
}
示例13: geodeVerboseShouldNotLogIfGeodeVerboseIsDeny
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
public void geodeVerboseShouldNotLogIfGeodeVerboseIsDeny() {
configureLogging(this.configFileGeodeVerboseDeny);
Logger logger = LogService.getLogger();
String msg = this.testName.getMethodName();
logger.info(LogMarker.GEODE_VERBOSE, msg);
assertThat(this.systemOutRule.getLog()).doesNotContain(msg);
}
示例14: testLogs
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
/**
* @author wasiq.bhamla
* @since 17-Jun-2017 6:18:03 PM
*/
@Test
public void testLogs () {
final Logger log = LogManager.getLogger (TestLogging.class);
log.info ("Testing info...");
log.warn ("Testing warn...");
log.error ("Testing error...");
log.debug ("Testing debug...");
log.trace ("Testing trace...");
log.fatal ("Testing fatal...");
}
示例15: handleMinecraftStart
import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
/**
* Handles minecraft starting.
*/
public static void handleMinecraftStart() {
Logger novousStart = LogManager.getLogger("NovousStart");
novousStart.info("Reached Implementation::handleMinecraftStart()");
handleLoggingImplementation(novousStart);
handleModLoading(novousStart);
handleModPreInit(novousStart);
handleBlockRegistration(novousStart);
}