2016-12-01 21 views
0

camelのhttpログを有効にするにはどうすればよいですか?私はrest-dslを使用しています。あなたはこのBeanを作成する必要がありますログインするコンポーネントを有効にするにはCamelの桟橋のコンポーネントのログ

restConfiguration() 
       .component("jetty") 
       .host("0.0.0.0") 
       .port(port) 
       .scheme("https") 
       .bindingMode(RestBindingMode.json) 
       .dataFormatProperty("json.in.disableFeatures", "FAIL_ON_UNKNOWN_PROPERTIES") 
       .dataFormatProperty("json.in.enableFeatures", "FAIL_ON_NULL_FOR_PRIMITIVES") 
       .componentProperty("sslKeyPassword", KEYSTORE_PASSWORD) 
       .componentProperty("sslKeystore", KEYSTORE) 
       .componentProperty("sslPassword", KEYSTORE_PASSWORD) 
       .enableCORS(true) 
       .componentProperty("traceEnabled", "true") 
       // swagger 
       .apiContextPath("api-doc") 
      .apiProperty("api.title", "Mobile Api").apiProperty("api.version", "v1.0") 
      .apiProperty("schemes", "https") 
      ; 

rest(MOBILE_API_PATH).produces("application/json").consumes("application/json") 

      .post("/transaction").type(MobileTransactionRequest.class).outType(MobileTransactionResponse.class) 
      .to("direct:mobileTransaction") 

答えて

1

:私は、HTTPヘッダーとすべてのリクエストとレスポンス私のコードのために遺体を見たい

<bean id="log" class="org.eclipse.jetty.server.handler.RequestLogHandler"> 
    <property name="requestLog" ref="jettyLog"/> 
</bean> 
<bean id="jettyLog" class="org.eclipse.jetty.server.Slf4jRequestLog"/> 

このようにenpointを設定してください:

jetty:http://0.0.0.0:8040/test?handlers=#log 

しかし、デフォルトでは、ロガーは本文とすべてのヘッダーを書きません。 AbstractLifeCycleを拡張し、独自のログロジックを持つRequestLogを実装するクラスを作成する必要があります。

関連する問題