本文整理汇总了Java中org.apache.log4j.lf5.DefaultLF5Configurator类的典型用法代码示例。如果您正苦于以下问题:Java DefaultLF5Configurator类的具体用法?Java DefaultLF5Configurator怎么用?Java DefaultLF5Configurator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultLF5Configurator类属于org.apache.log4j.lf5包,在下文中一共展示了DefaultLF5Configurator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.log4j.lf5.DefaultLF5Configurator; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
// Configure the LF5Appender using the DefaultLF5Configurator. This
// will add the LF5Appender to the root of the Category tree.
DefaultLF5Configurator.configure();
// Add an NDC to demonstrate how NDC information is output.
NDC.push("#23856");
// Log some information.
for (int i = 0; i < 10; i++) {
logger.debug("Hello, my name is Homer Simpson.");
logger.info("Mmmmmm .... Chocolate.");
logger.warn("Mmm...forbidden donut.");
}
// Clean up NDC
NDC.pop();
NDC.remove();
NDC.push("Another NDC");
// Log some information.
logger.fatal("Hello, my name is Bart Simpson.");
logger.error("Hi diddly ho good neighbour.");
// Clean up NDC
NDC.pop();
NDC.remove();
// Call methods on both classes.
InitUsingDefaultConfigurator.foo();
InnerInitUsingDefaultConfigurator.foo();
logger.info("Exiting InitUsingDefaultConfigurator.");
}
示例2: foo
import org.apache.log4j.lf5.DefaultLF5Configurator; //导入依赖的package包/类
static void foo() throws IOException {
// Configure the LF5Appender again. You can call
// DefaultLF5Configurator.configure() as often as you want
// without unexpected behavior.
DefaultLF5Configurator.configure();
logger.info("Entered foo in InnerInitUsingDefaultConfigurator class.");
}