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


Java Configurator.shutdown方法代码示例

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


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

示例1: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    // System.out.println(System.getProperty("java.class.path"));
    String config = args.length == 0 ? "target/test-classes/log4j2-319.xml" : args[0];
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config);
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        try {
            throw new NullPointerException();
        } catch (Exception e) {
            LOG.error("Error message.", e);
            LOG.catching(Level.ERROR, e);
        }
        LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?");
        LOG.info("Information message.");
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:24,代码来源:ConsoleAppenderAnsiStyleJira319Main.java

示例2: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    // System.out.println(System.getProperty("java.class.path"));
    String config = args.length == 0 ? "target/test-classes/log4j2-180.xml" : args[0];
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config);
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        try {
            throw new NullPointerException();
        } catch (Exception e) {
            LOG.error("Error message.", e);
            LOG.catching(Level.ERROR, e);
        }
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:22,代码来源:ConsoleAppenderAnsiStyleJira180Main.java

示例3: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    // System.out.println(System.getProperty("java.class.path"));
    String config = args.length == 0 ? "target/test-classes/log4j2-console-style-ansi.xml" : args[0];
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config);
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        LOG.error("Error message.", new IOException("test"));
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:17,代码来源:ConsoleAppenderAnsiStyleLayoutMain.java

示例4: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    // System.out.println(System.getProperty("java.class.path"));
    String config = args.length == 0 ? "target/test-classes/log4j2-272.xml" : args[0];
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config);
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        try {
            throw new NullPointerException();
        } catch (Exception e) {
            LOG.error("Error message.", e);
            LOG.catching(Level.ERROR, e);
        }
        LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?");
        LOG.info("Information message.");
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:24,代码来源:ConsoleAppenderAnsiStyleJira272Main.java

示例5: test

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public void test(final String[] args) {
    System.setProperty("log4j.skipJansi", "false"); // LOG4J2-2087: explicitly enable
    // System.out.println(System.getProperty("java.class.path"));
    final String config = args == null || args.length == 0 ? "target/test-classes/log4j2-console-xex-ansi.xml"
            : args[0];
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config);
    final Logger logger = LogManager.getLogger(ConsoleAppenderJAnsiXExceptionMain.class);
    try {
        Files.getFileStore(Paths.get("?BOGUS?"));
    } catch (final Exception e) {
        final IllegalArgumentException logE = new IllegalArgumentException("Bad argument foo", e);
        logger.error("Gotcha!", logE);
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:17,代码来源:ConsoleAppenderJAnsiXExceptionMain.java

示例6: exit

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void exit(ExitCode code) {
    if (code == null) {
        return;
    }

    log.info(code);
    Preferences.set("language", LanguageRegistry.getInstance().getCurrentLanguage().getName());
    Preferences.savePreferences();
    LoggerContext context = (LoggerContext) LogManager.getContext();
    Configurator.shutdown(context);
    System.exit(code.code());
}
 
开发者ID:Luke-Melaia,项目名称:Series-Freak,代码行数:13,代码来源:Application.java

示例7: stopCluster

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public final void stopCluster() throws Exception {
	for (Node node : esNodes) {
		try {
               node.close();
               LoggerContext context = (LoggerContext) LogManager.getContext(false);
               Configurator.shutdown(context);
               Thread.sleep(150);
           } catch (Throwable e) {
               e.printStackTrace();
           }
	}
	esNodes.clear();
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:14,代码来源:ClusterHelper.java

示例8: cleanup

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public void cleanup() {
    try {
        for (Thread thread : threads) {
            thread.join();
        }
    } catch (InterruptedException e) {
    }
    Configurator.shutdown((LoggerContext) LogManager.getContext());
}
 
开发者ID:ULYSSIS-KUL,项目名称:ipp,代码行数:10,代码来源:Runner.java

示例9: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(final String[] args) {
    final LoggerContext ctx = Configurator.initialize(FormatterLoggerManualExample.class.getName(),
            "target/test-classes/log4j2-console.xml");
    try {
        final User user = new User();
        logger.debug("User %s with birthday %s", user.getName(), user.getBirthdayCalendar());
        logger.debug("User %1$s with birthday %2$tm %2$te, %2$tY", user.getName(), user.getBirthdayCalendar());
        logger.debug("Integer.MAX_VALUE = %,d", Integer.MAX_VALUE);
        logger.debug("Long.MAX_VALUE = %,d", Long.MAX_VALUE);
    } finally {
        Configurator.shutdown(ctx);
    }

}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:18,代码来源:FormatterLoggerManualExample.java

示例10: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(),
            "target/test-classes/log4j2-console-style-name-ansi.xml");
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        LOG.error("Error message.", new IOException("test"));
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:16,代码来源:ConsoleAppenderAnsiStyleNameLayoutMain.java

示例11: validateXmlNoEvents

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
@Test
public void validateXmlNoEvents() throws Exception {
    final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
    file.delete();
    Configurator.shutdown(this.loggerContext);
    this.validateXmlSchema(file);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:8,代码来源:XmlCompactFileAppenderValidationTest.java

示例12: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(),
            "target/test-classes/log4j2-console-highlight-default.xml");
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        LOG.error("Error message.", new IOException("test"));
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:16,代码来源:ConsoleAppenderHighlightLayoutDefaultMain.java

示例13: main

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(),
            "target/test-classes/log4j2-console-highlight.xml");
    try {
        LOG.fatal("Fatal message.");
        LOG.error("Error message.");
        LOG.warn("Warning message.");
        LOG.info("Information message.");
        LOG.debug("Debug message.");
        LOG.trace("Trace message.");
        LOG.error("Error message.", new IOException("test"));
    } finally {
        Configurator.shutdown(ctx);
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:16,代码来源:ConsoleAppenderHighlightLayoutMain.java

示例14: validateXmlSchemaThrowable

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
@Test
public void validateXmlSchemaThrowable() throws Exception {
    final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
    file.delete();
    final Logger log = LogManager.getLogger("com.foo.Bar");
    try {
        throw new IllegalArgumentException("IAE");
    } catch (final IllegalArgumentException e) {
        log.warn("Message 1", e);
    }
    Configurator.shutdown(this.loggerContext);
    this.validateXmlSchema(file);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:14,代码来源:XmlCompactFileAppenderValidationTest.java

示例15: validateXmlSchema

import org.apache.logging.log4j.core.config.Configurator; //导入方法依赖的package包/类
@Test
public void validateXmlSchema() throws Exception {
    final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
    file.delete();
    final Logger log = LogManager.getLogger("com.foo.Bar");
    log.warn("Message 1");
    log.info("Message 2");
    log.debug("Message 3");
    Configurator.shutdown(this.loggerContext);
    this.validateXmlSchema(file);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:12,代码来源:XmlCompactFileAppenderValidationTest.java


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