當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。