Package org.apache.log4j

Examples of org.apache.log4j.Appender


    }

    public void testRequireBundleLogged()
    {
        final java.util.Set messages = new HashSet();
        Logger.getLogger("DataNucleus.Plugin").addAppender(new Appender()
        {
       
            public void setName(String arg0)
            {
            }
View Full Code Here


    }

    public void testRequireBundleVersionLogged()
    {
        final java.util.Set messages = new HashSet();
        Logger.getLogger("DataNucleus.Plugin").addAppender(new Appender()
        {
       
            public void setName(String arg0)
            {
            }
View Full Code Here

    String mdcMsgPattern4 = "%m : %X{key3}%n";
    String mdcMsgPattern5 = "%m : %X{key1},%X{key2},%X{key3}%n";
   
    // set up appender
    PatternLayout layout = new PatternLayout(msgPattern);
    Appender appender = new FileAppender(layout, OUTPUT_FILE+"_mdc", false);
           
    // set appender on root and set level to debug
    root.addAppender(appender);
    root.setLevel(Level.DEBUG);
   
View Full Code Here

  public void accept() throws Exception {
   
    // set up appender
    Layout layout = new SimpleLayout();
    Appender appender = new FileAppender(layout, ACCEPT_FILE, false);
   
    // create LevelMatchFilter
    LevelMatchFilter matchFilter = new LevelMatchFilter();
     // attach match filter to appender
    appender.addFilter(matchFilter);
  
    // attach DenyAllFilter to end of filter chain to deny neutral
    // (non matching) messages
    appender.addFilter(new DenyAllFilter());
       
    // set appender on root and set level to debug
    root.addAppender(appender);
    root.setLevel(Level.TRACE);
   
View Full Code Here

  public void deny() throws Exception {
   
    // set up appender
    Layout layout = new SimpleLayout();
    Appender appender = new FileAppender(layout, DENY_FILE, false);
   
    // create LevelMatchFilter, set to deny matches
    LevelMatchFilter matchFilter = new LevelMatchFilter();
    matchFilter.setAcceptOnMatch(false);
     // attach match filter to appender
    appender.addFilter(matchFilter);
          
    // set appender on root and set level to debug
    root.addAppender(appender);
    root.setLevel(Level.TRACE);
   
View Full Code Here

    root.getLoggerRepository().resetConfiguration();
  }

  public void test1() throws Exception {
    DOMConfigurator.configure("input/xml/fallback1.xml");
    Appender primary = root.getAppender("PRIMARY");
    ErrorHandler eh = primary.getErrorHandler();
    assertNotNull(eh);

    common();

    ControlFilter cf = new ControlFilter(new String[]{TEST1_PAT,
View Full Code Here

    assertTrue(Compare.compare(FILTERED, "witness/fallback1"));
  }
 
  public void test2() throws Exception {
    PropertyConfigurator.configure("input/fallback1.properties");
    Appender primary = root.getAppender("PRIMARY");
    ErrorHandler eh = primary.getErrorHandler();
    assertNotNull(eh);

    common();

    ControlFilter cf = new ControlFilter(new String[]{TEST1_PAT,
View Full Code Here

  public void propertiesTest() {
    Logger root = Logger.getRootLogger();
    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
    assertTrue(rootIsConfigured);
    Enumeration e = root.getAllAppenders();
    Appender appender = (Appender) e.nextElement();
    assertEquals(appender.getName(), "D3");
  }
View Full Code Here

  public void xmlTest() {
    Logger root = Logger.getRootLogger();
    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
    assertTrue(rootIsConfigured);
    Enumeration e = root.getAllAppenders();
    Appender appender = (Appender) e.nextElement();
    assertEquals(appender.getName(), "D1");
  }
View Full Code Here

  public void combinedTest() {
    Logger root = Logger.getRootLogger();
    boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();
    assertTrue(rootIsConfigured);
    Enumeration e = root.getAllAppenders();
    Appender appender = (Appender) e.nextElement();
    assertEquals(appender.getName(), "D1");
    assertEquals(e.hasMoreElements(), false);
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Appender

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.