TOS Java SDK提供了日志功能,您可以通过开启日志查看请求相关信息。
TOS Java SDK 使用 slf4j
日志框架,会在以下位置打印日志。
canonical request
日志,日志级别为 DEBUG
。string to sign
日志,日志级别为 DEBUG
。INFO
。INFO
。DEBUG
。TOS Java SDK 使用 slf4j
日志框架,使用时可根据业务情况选择 log4j、log4j2、JUL 等日志框架进行绑定和自定义设置。
日志内容示例如下。
18:11:35.627 [main] DEBUG com.volcengine.tos.auth.SignV4 - canonical request: GET / list-type=2&prefix=example_dir%2F date:20221209T101135Z host:bucket-example.your endpoint x-tos-date:20221209T101135Z date;host;x-tos-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 18:11:35.629 [main] DEBUG com.volcengine.tos.auth.SignV4 - string to sign: TOS4-HMAC-SHA256 20221209T101135Z 20221209/your region/tos/request 74ce8b173574bcb5dcd50cad3c35d1900121dd44e720ce62473756b69e44e1a3 18:22:55.046 [main] INFO com.volcengine.tos.internal.RequestTransport - tos: status code:404, request id:1cc948930c7f7d0463930c7f-ac1811f3-1p3aWt-GO-cgb-tos, request cost 512 ms, request 1 times 18:22:55.048 [main] DEBUG com.volcengine.tos.internal.RequestTransport - requestId: 1cc948930c7f7d0463930c7f-ac1811f3-1p3aWt-GO-cgb-tos, method: GET, host: bucket.tos-cn-beijing.volces.com, request uri: /example_dir%2Fexample_object.txt, dns cost: 112 ms, connect cost: 323 ms, tls handshake cost: 275 ms, send headers and body cost: 1 ms, wait response cost: 3 ms, request cost: 508 ms