Avalon LoggingCode ExampleThe following code is an example of a application loading and instantiating the Avalon Logging LogKit pluging. File dir = new File( System.getProperty( "user.dir" ) ); // // create an initial context // DefaultInitialContextFactory initial = new DefaultInitialContextFactory( "avalon", dir ); initial.setCacheDirectory( getRepositoryDirectory() ); InitialContext context = initial.createInitialContext(); // // get the plugin reference // Artifact artifact = Artifact.createArtifact( "artifact:avalon-logging/avalon-logkit-impl#1.0-SNAPSHOT" ); // // build the plugin // Builder builder = context.newBuilder( artifact ); Factory factory = builder.getFactory(); // // customize the plugin to you environment // File file = new File( dir, "logging.xml" ); Map criteria = factory.createDefaultCriteria(); criteria.put( "avalon.logging.configuration", file ); criteria.put( "avalon.logging.basedir", dir ); // // create the logging manager // LoggingManager manager = (LoggingManager) factory.create( criteria ); |