当前位置: 首页>>代码示例>>Java>>正文


Java Logger.fatal方法代码示例

本文整理汇总了Java中org.apache.logging.log4j.Logger.fatal方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.fatal方法的具体用法?Java Logger.fatal怎么用?Java Logger.fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.logging.log4j.Logger的用法示例。


在下文中一共展示了Logger.fatal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_181617_a

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
public static <V> V func_181617_a(FutureTask<V> p_181617_0_, Logger p_181617_1_)
{
    try
    {
        p_181617_0_.run();
        return p_181617_0_.get();
    }
    catch (ExecutionException executionexception)
    {
        p_181617_1_.fatal((String)"Error executing task", (Throwable)executionexception);
    }
    catch (InterruptedException interruptedexception)
    {
        p_181617_1_.fatal((String)"Error executing task", (Throwable)interruptedexception);
    }

    return (V)null;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:Util.java

示例2: test03

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Test
    public void test03() {
//        Logger logger = LogManager.getFormatterLogger();
        Logger logger = LogManager.getLogger();

        String name = "李志伟";
        Date birthday = new Date();

        logger.debug("用户名称:[{}], 日期:[{}]", name, birthday);
        logger.info("用户名称:[{}], 日期:[{}]", name, birthday);
        logger.warn("用户名称:[{}], 日期:[{}]", name, birthday);
        logger.error("用户名称:[{}], 日期:[{}]", name, birthday);
        logger.fatal("用户名称:[{}], 日期:[{}]", name, birthday);
        logger.error("异常信息提示", new RuntimeException("异常信息"));

        LogManager.shutdown();
    }
 
开发者ID:Lzw2016,项目名称:log4j2-learn,代码行数:18,代码来源:LogTest.java

示例3: runTask

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
@Nullable
public static <V> V runTask(FutureTask<V> task, Logger logger)
{
    try
    {
        task.run();
        return task.get();
    }
    catch (ExecutionException executionexception)
    {
        logger.fatal((String)"Error executing task", (Throwable)executionexception);
    }
    catch (InterruptedException interruptedexception)
    {
        logger.fatal((String)"Error executing task", (Throwable)interruptedexception);
    }

    return (V)null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:Util.java

示例4: main

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
	final Logger logger = LogManager.getLogger(StartSECC.class.getSimpleName());
	MiscUtils.setV2gEntityConfig(GlobalValues.SECC_CONFIG_PROPERTIES_PATH.toString());
	
	UDPServer udpServer = UDPServer.getInstance();
	TCPServer tcpServer = TCPServer.getInstance();
	TLSServer tlsServer = TLSServer.getInstance();
	
	if (!udpServer.initialize() || !tlsServer.initialize() || !tcpServer.initialize()) {
		logger.fatal("Unable to start SECC because UDP, TCP or TLS server could not be initialized");
	} else {
		Thread udpServerThread = new Thread(udpServer);
		udpServerThread.setName("UDPServerThread");
		
		Thread tcpServerThread = new Thread(tcpServer);
		tcpServerThread.setName("TCPServerThread");
		
		Thread tlsServerThread = new Thread(tlsServer);
		tlsServerThread.setName("TLSServerThread");
		
		// All transport layer threads need to be initialized before initializing the SECC session handler.
		new V2GCommunicationSessionHandlerSECC();
		
		/*
		 * To avoid possible race conditions, the transport layer threads need to be started AFTER the SECC
		 * session handler has been initialized. Otherwise the situation might occur that the UDPServer is 
		 * receiving a UDP client packet and tries to access the MessageHandler object before this object has
		 * been created by the SECC session handler.
		 */
		udpServerThread.start();
		tcpServerThread.start();
		tlsServerThread.start();
	} 
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:35,代码来源:StartSECC.java

示例5: 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();
}
 
开发者ID:Lzw2016,项目名称:log4j2-learn,代码行数:15,代码来源:LogTest.java

示例6: 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...");
}
 
开发者ID:WasiqB,项目名称:coteafs-logger,代码行数:15,代码来源:TestLogging.java

示例7: testLogOutput

import org.apache.logging.log4j.Logger; //导入方法依赖的package包/类
/**
 * Verifies that writing to a Log4j logger will end up in the LogWriter's output.
 */
@Test
public final void testLogOutput() throws IOException {
  // Create the appender
  final StringWriter stringWriter = new StringWriter();
  final PureLogWriter logWriter =
      new PureLogWriter(InternalLogWriter.FINEST_LEVEL, new PrintWriter(stringWriter), "");

  final AppenderContext[] contexts = new AppenderContext[2];
  contexts[0] = LogService.getAppenderContext(); // root context
  contexts[1] = LogService.getAppenderContext(LogService.BASE_LOGGER_NAME); // "org.apache"
                                                                            // context

  this.appender =
      LogWriterAppender.create(contexts, LogService.MAIN_LOGGER_NAME, logWriter, null);

  final Logger logger = LogService.getLogger();

  // set the level to TRACE
  Configurator.setLevel(LogService.BASE_LOGGER_NAME, Level.TRACE);
  Configurator.setLevel(LogService.MAIN_LOGGER_NAME, Level.TRACE);

  assertEquals(Level.TRACE, logger.getLevel());

  logger.trace("TRACE MESSAGE");
  assertTrue(Pattern.compile(".*\\[finest .*TRACE MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  logger.debug("DEBUG MESSAGE");
  assertTrue(Pattern.compile(".*\\[fine .*DEBUG MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  logger.info("INFO MESSAGE");
  assertTrue(Pattern.compile(".*\\[info .*INFO MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  logger.warn("ExpectedStrings: WARNING MESSAGE");
  assertTrue(Pattern.compile(".*\\[warning .*WARNING MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  logger.error("ExpectedStrings: ERROR MESSAGE");
  assertTrue(Pattern.compile(".*\\[error .*ERROR MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  logger.fatal("ExpectedStrings: FATAL MESSAGE");
  assertTrue(Pattern.compile(".*\\[severe .*FATAL MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  final Logger lowerLevelLogger =
      LogService.getLogger(LogService.BASE_LOGGER_NAME + ".subpackage");
  lowerLevelLogger.fatal("ExpectedStrings: FATAL MESSAGE");
  assertTrue(Pattern.compile(".*\\[severe .*FATAL MESSAGE.*", Pattern.DOTALL)
      .matcher(stringWriter.toString()).matches());
  stringWriter.getBuffer().setLength(0);

  this.appender.destroy();
  assertFalse(Configurator.getLoggerConfig(LogService.BASE_LOGGER_NAME).getAppenders()
      .containsKey(this.appender.getName()));
}
 
开发者ID:ampool,项目名称:monarch,代码行数:68,代码来源:LogWriterAppenderJUnitTest.java


注:本文中的org.apache.logging.log4j.Logger.fatal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。