1 19 package org.apache.avalon.excalibur.logger.factory; 20 21 import org.apache.avalon.framework.configuration.Configuration; 22 import org.apache.avalon.framework.configuration.ConfigurationException; 23 import org.apache.log.LogTarget; 24 import org.apache.log.format.Formatter; 25 import org.apache.log.output.io.StreamTarget; 26 27 56 public class ConsoleTargetFactory 57 extends AbstractTargetFactory 58 { 59 60 63 public final LogTarget createTarget( final Configuration configuration ) 64 throws ConfigurationException 65 { 66 final Configuration confFormat = configuration.getChild( "format" ); 67 final Formatter formatter = getFormatter( confFormat ); 68 69 final LogTarget logtarget = new StreamTarget(System.out, formatter); 70 71 return logtarget; 72 } 73 74 protected Formatter getFormatter( final Configuration conf ) 75 { 76 Formatter formatter = null; 77 78 if( null != conf ) 79 { 80 final FormatterFactory formatterFactory = new FormatterFactory(); 81 formatter = formatterFactory.createFormatter( conf ); 82 } 83 84 return formatter; 85 } 86 } 87 | Popular Tags |