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."); }
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."); }