コード例 #1
0
ファイル: LogbackValve.java プロジェクト: hmalphettes/logback
  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);
    }
  }
コード例 #2
0
ファイル: Logger.java プロジェクト: hmalphettes/logback
 private int appendLoopOnAppenders(ILoggingEvent event) {
   if (aai != null) {
     return aai.appendLoopOnAppenders(event);
   } else {
     return 0;
   }
 }
コード例 #3
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);
 }