Package org.jzonic.jlo

Examples of org.jzonic.jlo.LogConfiguration


  
    public void testXMLFileReader() {       
        try {
            XMLFileReader reader = new XMLFileReader();
            reader.setFileName("jlo_logging.xml");       
            LogConfiguration lc = reader.parseConfiguration("test");
            assertNotNull( lc );
            assertEquals(4,lc.getLogGeneratorCount());
            assertEquals(4,lc.getLoggerCount());
            assertEquals(1,lc.getChannelCount());
            Logger logger = lc.getLogger("org.jzonic");
            assertNotNull(logger);
            assertEquals(2,logger.getLogGenerators().size());
            assertEquals(2,lc.getLogPipesCount());
            assertEquals(2,lc.getFilterCount());
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("unexpected exception");
        }
View Full Code Here


    public void testBrokenConfiguration() {
      System.setProperty("jlo.errorhandler","org.jzonic.jlo.error.MockErrorReporter");
      try {
            XMLFileReader reader = new XMLFileReader();
            reader.setFileName("broken_logging.xml");       
            LogConfiguration lc = reader.parseConfiguration("broken_test");
            assertNotNull( lc );
            MockErrorReporter mer = (MockErrorReporter)ErrorHandlerFactory.getErrorReporter();
            List all = mer.getMessages();
            assertEquals(3,all.size());
        }
View Full Code Here

   
    public void testBrokenConfiguration() {
      try {
            XMLFileReader reader = new XMLFileReader();
            reader.setFileName("broken_logging.xml");       
            LogConfiguration lc = reader.parseConfiguration("broken_test");
            assertNotNull( lc );
            assertEquals(3,lc.getLogGeneratorCount());
            assertEquals(2,lc.getLoggerCount());
            assertEquals(1,lc.getChannelCount());
            Logger logger = lc.getLogger("org.jzonic.jlo");
            assertNotNull(logger);
            assertEquals(0,logger.getLogGenerators().size());
            assertEquals(0,lc.getLogPipesCount());
            assertEquals(0,lc.getFilterCount());
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("unexpected exception");
        }
View Full Code Here

    /** Creates a new instance of MockReader */
    public MockReader() {
    }
   
    public LogConfiguration parseConfiguration(String name) throws ReaderException {
        LogConfiguration lc = new LogConfiguration("Test");
        Handler handler = new MockHandler("Test");
        Formatter simpleFormatter = new SimpleFormatter("Test");        
        LogGenerator lg = new LogGenerator("org.jzonic.jlo", handler, simpleFormatter);
        Logger logger = new Logger("org.jzonic.jlo", Target.parse("ALL"),"Test");
        logger.addLogGenerator(lg);
        lc.addLogger( logger );
        Logger seclogger = new Logger("org.jzonic", Target.parse("ALL,!INIT"),"Test");
        seclogger.addLogGenerator(lg);
        lc.addLogger( seclogger );
        Logger thirdlogger = new Logger("org", Target.parse("INIT,FATAL"),"Test");
        thirdlogger.addLogGenerator(lg);
        lc.addLogger( thirdlogger );
        return lc;
    }               
View Full Code Here

TOP

Related Classes of org.jzonic.jlo.LogConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.