donaldp 2002/09/27 21:45:35 Modified: src/test/org/apache/avalon/phoenix/components/logger/test LogManagerTestCase.java Added: src/test/org/apache/avalon/phoenix/components/logger/test config2.xml Log: Add in unit tests to test the excalibur-logger infrastructure. Revision Changes Path 1.3 +21 -2 jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/LogManagerTestCase.java Index: LogManagerTestCase.java =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/LogManagerTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LogManagerTestCase.java 28 Sep 2002 04:05:27 -0000 1.2 +++ LogManagerTestCase.java 28 Sep 2002 04:45:35 -0000 1.3 @@ -22,6 +22,7 @@ import org.apache.avalon.phoenix.metadata.BlockListenerMetaData; import org.apache.avalon.phoenix.metadata.BlockMetaData; import org.apache.avalon.phoenix.metadata.SarMetaData; +import org.apache.log.Hierarchy; /** * An basic test case for the LogManager. @@ -69,7 +70,25 @@ public void testBasic() throws Exception { - final int index = 1; + runtTestForConfigFile( 1 ); + } + + public void testExcaliburLogger() + throws Exception + { + Hierarchy hierarchy = new Hierarchy(); + final org.apache.log.Logger root = hierarchy.getLoggerFor( "" ); + final org.apache.log.Logger bah = root.getChildLogger( "bah" ); + final org.apache.log.Logger bah2 = hierarchy.getLoggerFor( "bah" ); + System.out.println( "root = " + root ); + System.out.println( "bah = " + bah ); + System.out.println( "bah2 = " + bah2 ); + + runtTestForConfigFile( 2 ); + } + + private void runtTestForConfigFile( final int index ) throws Exception + { final Logger hierarchy = createHierarchy( index ); runLoggerTest( hierarchy, DEFAULT_LOGFILE, index ); 1.1 jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/config2.xml Index: config2.xml =================================================================== <logs version="1.1"> <!-- see http://jakarta.apache.org/avalon/excalibur/logger/index.html --> <factories> <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/> </factories> <categories> <category name="" log-level="DEBUG"> <log-target id-ref="default"/> </category> <category name="myBlock" log-level="DEBUG"> <log-target id-ref="myBlock"/> </category> </categories> <targets> <file id="default"> <filename>${app.home}/logs/default.log</filename> <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format> <append>true</append> </file> <file id="myBlock"> <filename>${app.home}/logs/myBlock.log</filename> <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format> <append>true</append> </file> </targets> </logs>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>