Package ch.qos.logback.core

Examples of ch.qos.logback.core.ContextBase


*/
public class PrintMe {
 
 
  public static void main(String[] args) throws Exception {
    Context context = new ContextBase();
   
    Map<Pattern, Action> ruleMap = new HashMap<Pattern, Action>();

   
    // we start with the rule for the top-most (root) element
View Full Code Here


* @author Ceki G&uuml;ulc&uuml;
*/
public class Calculator1 {

  public static void main(String[] args) throws Exception {
    Context context = new ContextBase();

    Map<Pattern, Action> ruleMap = new HashMap<Pattern, Action>();

    // Associate "/computation" pattern with ComputationAction1
    ruleMap.put(new Pattern("/computation"), new ComputationAction1());
View Full Code Here

    ruleMap.put(new Pattern("*/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("*/computation/add"), new AddAction());
    ruleMap.put(new Pattern("*/computation/multiply"), new MultiplyAction());
   
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
View Full Code Here

* @author Ceki G&uuml;ulc&uuml;
*/
public class NewRuleCalculator {
  public static void main(String[] args) throws Exception {
 
    Context context = new ContextBase();
 
   
    Map<Pattern, Action> ruleMap = new HashMap<Pattern, Action>();

    // we start with the rule for the top-most (root) element
View Full Code Here

    // Associate "hello-world" pattern with  HelloWorldAction
    ruleMap.put(new Pattern("hello-world"), new HelloWorldAction());

    // Joran needs to work within a context.
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
View Full Code Here

    outputStream = null;
  }
 
  @Test
  public void testBasic() {
    Context context = new ContextBase();
    context.getStatusManager().add(new InfoStatus("test", this));
    StatusPrinter.print(context);
    String result = outputStream.toString();
    assertTrue(result.contains("|-INFO in "+this.getClass().getName()));
  }
View Full Code Here

    s2.add(s21);
    s2.add(s22);
    s21.add(s211);
   
   
    Context context = new ContextBase();
    context.getStatusManager().add(s0);
    context.getStatusManager().add(s1);
    context.getStatusManager().add(s2);

    StatusPrinter.print(context);
    String result = outputStream.toString();
    assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
    assertTrue(result.contains("+ WARN in "+this.getClass().getName()));
View Full Code Here

    Status s22 = new InfoStatus("test22", this);
    s2.add(s21);
    s2.add(s22);
    s21.add(s211);
   
    Context context = new ContextBase();
    context.getStatusManager().add(s0);
    context.getStatusManager().add(s1);
    context.getStatusManager().add(s2);
    StatusPrinter.print(context)
    String result = outputStream.toString();
    assertTrue(result.contains("|-ERROR in "+this.getClass().getName()));
    assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
    assertTrue(result.contains("ch.qos.logback.core.util.StatusPrinterTest.testWithException"));
View Full Code Here

  protected void stop() {
    addInfo("Logback context being closed via shutdown hook");

    Context hookContext = getContext();
    if (hookContext instanceof ContextBase) {
      ContextBase context = (ContextBase) hookContext;
      context.stop();
    }
  }
View Full Code Here

  Context context;
  Matcher matcher;
 
  public void setUp() throws Exception {
    context = new ContextBase();
    matcher = new Matcher();
    matcher.setContext(context);
    matcher.setName("testMatcher");
    super.setUp();
  }
View Full Code Here

TOP

Related Classes of ch.qos.logback.core.ContextBase

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.