ConfiguratorThe Configurator class has two static methods to create LoggerStores based on the configuration resource - which can be path to a file or an InputStream: public static LoggerStore createLoggerStore( final String configuratorType, final String resource ) throws Exception; public static LoggerStore createLoggerStore( final String configuratorType, final InputStream resource ) throws Exception; The configurator type may be
loggerstore.propertiesLoggerStore may also be configured via a property found in the jar META-INF: META-INF/spice/loggerstore.properties final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); return factory.createLoggerStore( new HashMap() ); The loggerstore.properties file contains the LoggerStore factory implementation class name and the path the the configuration resource. For example: org.jcomponent.loggerstore.factory=org.jcomponent.loggerstore.factories.ExcaliburLogKitLoggerStoreFactory org.jcomponent.loggerstore.file=/path/to/logconfig.xml The possible factory classes are:
LoggerStoreFactoryOne can also instantiate directly one of the above LoggerStoreFactory classes and call the create method with the appropriate configuration parameters. The configuration map may contain different resources indexed by the class name: The possible factory classes are:
final LoggerStoreFactory factory = new DOMLog4JLoggerStoreFactory(); final Map config = new HashMap(); final Element element = ... // parsed via some JAXP parser config.put("org.w3c.dom.Element", element); return factory.createLoggerStore( config ); |