Exemplo n.º 1
0
 @SuppressWarnings("unchecked")
 public Iterator<Appender<ILoggingEvent>> iteratorForAppenders() {
   if (aai == null) {
     return Collections.EMPTY_LIST.iterator();
   }
   return aai.iteratorForAppenders();
 }
Exemplo n.º 2
0
  public void invoke(Request request, Response response) throws IOException, ServletException {

    try {

      if (!alreadySetLogbackStatusManager) {
        alreadySetLogbackStatusManager = true;
        org.apache.catalina.Context tomcatContext = request.getContext();
        if (tomcatContext != null) {
          ServletContext sc = tomcatContext.getServletContext();
          if (sc != null) {
            sc.setAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY, getStatusManager());
          }
        }
      }

      getNext().invoke(request, response);

      TomcatServerAdapter adapter = new TomcatServerAdapter(request, response);
      AccessEvent accessEvent = new AccessEvent(request, response, adapter);

      if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
        return;
      }

      // TODO better exception handling
      aai.appendLoopOnAppenders(accessEvent);
    } finally {
      request.removeAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
    }
  }
Exemplo n.º 3
0
 private int appendLoopOnAppenders(ILoggingEvent event) {
   if (aai != null) {
     return aai.appendLoopOnAppenders(event);
   } else {
     return 0;
   }
 }
Exemplo n.º 4
0
 public void log(Request jettyRequest, Response jettyResponse) {
   JettyServerAdapter adapter = new JettyServerAdapter(jettyRequest, jettyResponse);
   AccessEvent accessEvent = new AccessEvent(jettyRequest, jettyResponse, adapter);
   if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
     return;
   }
   aai.appendLoopOnAppenders(accessEvent);
 }
Exemplo n.º 5
0
 public void detachAndStopAllAppenders() {
   aai.detachAndStopAllAppenders();
 }
Exemplo n.º 6
0
 public boolean isAttached(Appender<AccessEvent> appender) {
   return aai.isAttached(appender);
 }
Exemplo n.º 7
0
 public Appender<AccessEvent> getAppender(String name) {
   return aai.getAppender(name);
 }
Exemplo n.º 8
0
 public Iterator<Appender<AccessEvent>> iteratorForAppenders() {
   return aai.iteratorForAppenders();
 }
Exemplo n.º 9
0
 public void addAppender(Appender<AccessEvent> newAppender) {
   aai.addAppender(newAppender);
 }
Exemplo n.º 10
0
 public void stop() {
   aai.detachAndStopAllAppenders();
   started = false;
 }
Exemplo n.º 11
0
 public boolean detachAppender(String name) {
   if (aai == null) {
     return false;
   }
   return aai.detachAppender(name);
 }
Exemplo n.º 12
0
 /** Remove the appender passed as parameter form the list of appenders. */
 public boolean detachAppender(Appender<ILoggingEvent> appender) {
   if (aai == null) {
     return false;
   }
   return aai.detachAppender(appender);
 }
Exemplo n.º 13
0
 public Appender<ILoggingEvent> getAppender(String name) {
   if (aai == null) {
     return null;
   }
   return aai.getAppender(name);
 }
Exemplo n.º 14
0
 public boolean isAttached(Appender<ILoggingEvent> appender) {
   if (aai == null) {
     return false;
   }
   return aai.isAttached(appender);
 }
Exemplo n.º 15
0
 // this method MUST be synchronized. See comments on 'aai' field for further
 // details.
 public synchronized void addAppender(Appender<ILoggingEvent> newAppender) {
   if (aai == null) {
     aai = new AppenderAttachableImpl<ILoggingEvent>();
   }
   aai.addAppender(newAppender);
 }
Exemplo n.º 16
0
 public boolean detachAppender(Appender<AccessEvent> appender) {
   return aai.detachAppender(appender);
 }
Exemplo n.º 17
0
 public boolean detachAppender(String name) {
   return aai.detachAppender(name);
 }
Exemplo n.º 18
0
 /**
  * Remove all previously added appenders from this logger instance.
  *
  * <p>This is useful when re-reading configuration information.
  */
 public void detachAndStopAllAppenders() {
   if (aai != null) {
     aai.detachAndStopAllAppenders();
   }
 }