本文整理匯總了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.");
}