示例#1
0
  @PostConstruct
  private void init() {
    if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
      addLogstashAppender(context);

      // Add context listener
      LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
      loggerContextListener.setContext(context);
      context.addListener(loggerContextListener);
    }
  }
  @Override
  public void end(InterpretationContext ec, String name) throws ActionException {
    if (inError) {
      return;
    }
    Object o = ec.peekObject();

    if (o != lcl) {
      addWarn(
          "The object on the top the of the stack is not the LoggerContextListener pushed earlier.");
    } else {
      if (lcl instanceof LifeCycle) {
        ((LifeCycle) lcl).start();
        addInfo("Starting LoggerContextListener");
      }
      ((LoggerContext) context).addListener(lcl);
      ec.popObject();
    }
  }
 @Before
 public void setUp() throws Exception {
   context = new LoggerContext();
   listener = new BasicContextListener();
   context.addListener(listener);
 }
 @Before
 public void setUp() {
   levelChangePropagator.setContext(loggerContext);
   loggerContext.addListener(levelChangePropagator);
 }