Google Drive API Java客户端库日志记录

时间:2018-07-02 12:19:10

标签: java google-api google-drive-api google-api-java-client

Google Drive API Java客户端是否记录传出的REST-HTTP请求和传入的REST-HTTP响应?

这对于调试API调用以确保正在处理正确的请求和响应非常重要。

是否可以打开日志记录以查看通过DRIVE API调用发送给Google的请求和响应?

谢谢

1 个答案:

答案 0 :(得分:1)

它使用java.util.logging.Logger记录HTTP请求和响应详细信息,包括URL,标头和内容。

通常,日志记录是使用logging.properties文件管理的。例如:

# Properties file which configures the operation of the JDK logging facility.
# The system will look for this config file to be specified as a system property:
# -Djava.util.logging.config.file=${project_loc:googleplus-simple-cmdline-sample}/logging.properties

# Set up the console handler (uncomment "level" to show more fine-grained messages)
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = CONFIG

# Set up logging of HTTP requests and responses (uncomment "level" to show)
com.google.api.client.http.level = CONFIG

有关更多信息,请参见logging