Author: mcconnell Date: Tue Jun 8 09:22:13 2004 New Revision: 20910 Added: avalon/trunk/runtime/logging/impl/build.xml (contents, props changed) avalon/trunk/runtime/logging/log4j/build.xml (contents, props changed) avalon/trunk/runtime/logging/logkit/api/build.xml (contents, props changed) avalon/trunk/runtime/logging/logkit/impl/build.xml (contents, props changed) avalon/trunk/runtime/logging/logkit/plugins/datagram/build.xml (contents, props changed) avalon/trunk/runtime/logging/logkit/plugins/socket/build.xml (contents, props changed) avalon/trunk/runtime/logging/logkit/plugins/syslog/build.xml (contents, props changed) avalon/trunk/runtime/logging/spi/build.xml (contents, props changed) avalon/trunk/runtime/logging/test/build.xml (contents, props changed) avalon/trunk/runtime/logging/test/etc/ avalon/trunk/runtime/logging/test/etc/test/ avalon/trunk/runtime/logging/test/etc/test/unit/ avalon/trunk/runtime/logging/test/etc/test/unit/log4j/ avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.properties (contents, props changed) avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.xml (contents, props changed) avalon/trunk/runtime/logging/test/etc/test/unit/logkit/ avalon/trunk/runtime/logging/test/etc/test/unit/logkit/logging.xml (contents, props changed) avalon/trunk/runtime/logging/test/etc/test/unit/system.xml (contents, props changed) Modified: avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/DefaultLoggingFactory.java avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/factory/PluginTargetFactory.java avalon/trunk/runtime/logging/test/src/test/org/apache/avalon/logging/LoggingManagerHelper.java Log: Update the logging package to build against the project tools.
Added: avalon/trunk/runtime/logging/impl/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/impl/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-impl" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Added: avalon/trunk/runtime/logging/log4j/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/log4j/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-log4j" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + + <target name="package" depends="standard.package"> + <x:artifact/> + </target> + +</project> + Added: avalon/trunk/runtime/logging/logkit/api/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/logkit/api/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-logkit-api" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + +</project> + Added: avalon/trunk/runtime/logging/logkit/impl/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/logkit/impl/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-logkit-impl" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + <target name="package" depends="standard.package"> + <x:artifact/> + </target> + +</project> Modified: avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/DefaultLoggingFactory.java ============================================================================== --- avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/DefaultLoggingFactory.java (original) +++ avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/DefaultLoggingFactory.java Tue Jun 8 09:22:13 2004 @@ -50,7 +50,7 @@ import org.apache.avalon.util.i18n.ResourceManager; import org.apache.avalon.util.i18n.Resources; -import org.apache.excalibur.configuration.ConfigurationUtil; +import org.apache.avalon.util.configuration.ConfigurationUtil; import org.apache.log.LogTarget; Modified: avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/factory/PluginTargetFactory.java ============================================================================== --- avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/factory/PluginTargetFactory.java (original) +++ avalon/trunk/runtime/logging/logkit/impl/src/java/org/apache/avalon/logging/logkit/factory/PluginTargetFactory.java Tue Jun 8 09:22:13 2004 @@ -38,7 +38,7 @@ import org.apache.avalon.util.i18n.ResourceManager; import org.apache.avalon.util.i18n.Resources; -import org.apache.excalibur.configuration.ConfigurationUtil; +import org.apache.avalon.util.configuration.ConfigurationUtil; import org.apache.log.LogTarget; import org.apache.log.LogEvent; @@ -126,15 +126,15 @@ // try - { - final String uri = "artifact:" + spec; + { + String uri = getURI( spec ); Artifact artifact = Artifact.createArtifact( uri ); Builder builder = m_context.newBuilder( m_classloader, artifact ); Class clazz = builder.getFactoryClass(); LogTargetFactory factory = m_builder.buildLogTargetFactory( clazz ); - m_factories.put( spec, factory ); + m_factories.put( uri, factory ); return factory; } catch( Throwable e ) @@ -143,6 +143,12 @@ REZ.getString( "plugin.error.build", spec ); throw new LogTargetException( error, e ); } + } + + private String getURI( String spec ) + { + if( spec.startsWith( "artifact:" ) ) return spec; + return "artifact:" + spec; } } Added: avalon/trunk/runtime/logging/logkit/plugins/datagram/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/logkit/plugins/datagram/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-logkit-datagram" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + <target name="package" depends="standard.package"> + <x:artifact/> + </target> + +</project> Added: avalon/trunk/runtime/logging/logkit/plugins/socket/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/logkit/plugins/socket/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-logkit-socket" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + <target name="package" depends="standard.package"> + <x:artifact/> + </target> + +</project> Added: avalon/trunk/runtime/logging/logkit/plugins/syslog/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/logkit/plugins/syslog/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-logkit-syslog" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + <target name="package" depends="standard.package"> + <x:artifact/> + </target> + +</project> Added: avalon/trunk/runtime/logging/spi/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/spi/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-spi" default="dist" basedir="."> + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> +</project> Added: avalon/trunk/runtime/logging/test/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/test/build.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-logging-tet" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools"> + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + + <target name="init" depends="standard.init"> + <x:filter key="avalon-logging-logkit-impl" feature="uri" + token="AVALON-LOGGING-LOGKIT-SPEC"/> + <x:filter key="avalon-logging-log4j" feature="uri" + token="AVALON-LOGGING-LOG4J-SPEC"/> + <x:filter key="avalon-logging-logkit-datagram" feature="uri" + token="AVALON-LOGGING-LOGKIT-DATAGRAM-SPEC"/> + <x:filter key="avalon-logging-logkit-syslog" feature="uri" + token="AVALON-LOGGING-LOGKIT-SYSLOG-SPEC"/> + </target> + + <target name="install" depends="test"/> + +</project> Added: avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.properties ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.properties Tue Jun 8 09:22:13 2004 @@ -0,0 +1,14 @@ + +log4j.rootLogger=DEBUG, A1 +log4j.appender.A1=org.apache.log4j.FileAppender +log4j.appender.A1.file=target/alt-output.log + +log4j.appender.A1.layout=org.apache.log4j.PatternLayout + +# Print the date in ISO 8601 format +log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.avalon.logging=DEBUG +log4j.logger.kernel.logger=WARN +log4j.logger.kernel.logger.test=DEBUG Added: avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/test/etc/test/unit/log4j/log4j.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<log4j:configuration + xmlns:log4j="http://jakarta.apache.org/log4j/" + debug="false" +> + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.err"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> + </layout> + </appender> + + <appender name="FILE" class="org.apache.log4j.FileAppender"> + <param name="File" value="target/output.log"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> + </layout> + </appender> + + <category name="org.apache.avalon.logging"> + <priority value="DEBUG"/> + </category> + + <category name="kernel.logger"> + <priority value="WARN"/> + </category> + + <category name="kernel.logger.test"> + <priority value="DEBUG"/> + </category> + + <root> + <appender-ref ref="FILE"/> + </root> + +</log4j:configuration> + Added: avalon/trunk/runtime/logging/test/etc/test/unit/logkit/logging.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/test/etc/test/unit/logkit/logging.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<logging debug="false"> + + <!-- + Declaration of a set of logging targets. + --> + + <targets> + + <!-- + This target establishes output to the the System.out stream. + The format argument ensures that we don't get stack traces - + but just the error report. + --> + <stream id="standard"> + <name>System.out</name> + <format type="console"/> + </stream> + + <!-- + This target logs to a rotating file located in + target/simple-XXX.log + --> + <file id="simple"> + <filename>simple.log</filename> + <append>true</append> + <rotation type="revolving" init="1" max="10"> + <size>100k</size> + </rotation> + </file> + + <!-- + The multicast target redirects log event to a set of + named targets. + --> + <multicast id="multicast"> + <targetref id="standard"/> + <targetref id="simple"/> + </multicast> + + <!-- + This target is a demonstration of the declaration of + a datagram plugin target. + --> + <target id="datagram" + artifact="@AVALON-LOGGING-LOGKIT-DATAGRAM-SPEC@"> + <address hostname="localhost" port="0"/> + </target> + + <!-- + The target is a demonstration of the declaration of + the syslog plugin target. + --> + <target id="syslog" + artifact="@AVALON-LOGGING-LOGKIT-SYSLOG-SPEC@"> + <address hostname="localhost" port="514" facility="USER"/> + <format type="extended"> + %7.7{priority} %23.23{time:yyyy-MM-dd HH:mm:ss:SSS} [%25.25{category}] : %{message}\n%{throwable} + </format> + </target> + + <!-- + The target shows the configuration of a plugable smtp target (which + has not been committed to CVS yet). + --> + <!-- + <target id="smtp" + artifact="avalon-logging/avalon-logkit-smtp#1.0.0"> + <to>[EMAIL PROTECTED]</to> + <from>[EMAIL PROTECTED]</from> + <subject>logging target test</subject> + <maximum-size>1</maximum-size> + <session> + </session> + </target> + --> + + </targets> + + <!-- + Declaration of the initial logging categories. These categories + and the respective priorities and assigned targets are used by the + testcase to validate that the logging system is functioning properly. + --> + + <categories priority="info" target="multicast"> + <categories name="kernel"> + <categories name="logger" priority="warn"> + <category name="test" priority="fatal_error"/> + </categories> + <category name="roger-ramjet" priority="debug"/> + </categories> + </categories> + + <!-- + Selection of the logging channel for use by the logging + system following establishment of inital targets and categories. + --> + + <logger name="kernel.logger"/> + +</logging> Added: avalon/trunk/runtime/logging/test/etc/test/unit/system.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/logging/test/etc/test/unit/system.xml Tue Jun 8 09:22:13 2004 @@ -0,0 +1,9 @@ +<!-- +Configuration used by the DefaultInitialContextFactoryTest to validate the +populatation of registered artifacts with the initial context. +--> + +<system> + <artifact spec="@AVALON-LOGGING-LOGKIT-SPEC@"/> + <artifact spec="@AVALON-LOGGING-LOG4J-SPEC@"/> +</system> \ No newline at end of file Modified: avalon/trunk/runtime/logging/test/src/test/org/apache/avalon/logging/LoggingManagerHelper.java ============================================================================== --- avalon/trunk/runtime/logging/test/src/test/org/apache/avalon/logging/LoggingManagerHelper.java (original) +++ avalon/trunk/runtime/logging/test/src/test/org/apache/avalon/logging/LoggingManagerHelper.java Tue Jun 8 09:22:13 2004 @@ -57,7 +57,7 @@ String id, String filename ) throws Exception { InitialContext context = - setUpInitialContext( "target/test-classes/conf/system.xml" ); + setUpInitialContext( "system.xml" ); Artifact[] candidates = context.getRepository().getCandidates( LoggingManager.class ); Artifact artifact = selectArtifact( candidates, id ); @@ -72,11 +72,13 @@ File basedir = getBaseDir(); File target = new File( basedir, "target" ); - File conf = new File( target, "test-classes/conf" ); - File file = new File( conf, filename ); + //File conf = new File( target, "test-classes/conf" ); + //File file = new File( conf, filename ); + File file = new File( basedir, filename ); criteria.put( "avalon.logging.configuration", file ); - criteria.put( "avalon.logging.basedir", target ); + //criteria.put( "avalon.logging.basedir", target ); + criteria.put( "avalon.logging.basedir", basedir ); // // create the logging manager @@ -90,12 +92,25 @@ { DefaultInitialContextFactory factory = new DefaultInitialContextFactory( "avalon", getBaseDir() ); - factory.setCacheDirectory( getMavenRepositoryDirectory() ); + factory.setCacheDirectory( getRepositoryCache() ); Artifact[] artifacts = getArtifactsToRegister( path ); factory.setFactoryArtifacts( artifacts ); return factory.createInitialContext(); } + + private static File getRepositoryCache() + { + String cache = System.getProperty( "project.repository.cache.path" ); + if( null != cache ) + { + return new File( cache ); + } + else + { + return getMavenRepositoryDirectory(); + } + } private static Artifact selectArtifact( Artifact[] artifacts, String id ) { @@ -162,12 +177,19 @@ for( int i=0; i<children.length; i++ ) { Configuration child = children[i]; - String spec = child.getAttribute( "spec" ); - Artifact artifact = Artifact.createArtifact( "artifact:" + spec ); + String spec = child.getAttribute( "spec" ); + String uri = getURI( spec ); + Artifact artifact = Artifact.createArtifact( uri ); artifacts[i] = artifact; } return artifacts; } + + private static String getURI( String spec ) + { + if( spec.startsWith( "artifact:" ) ) return spec; + return "artifact:" + spec; + } private static Configuration getConfiguration( File file ) throws Exception { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]