java - Google Drive API Java 客户端库日志记录
问题描述
Google Drive API Java 客户端是否记录传出 REST - HTTP 请求和传入 REST - HTTP 响应?
这对于调试 API 调用以确保处理正确的请求和响应非常重要。
有没有办法打开日志记录以查看通过 DRIVE API 调用发送给 Google 的请求和响应?
谢谢
解决方案
它使用 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
有关更多信息,请参阅日志记录
推荐阅读
- python - 与线程一起使用时,cv2 imshow 在关闭并再次打开后不再打开窗口
- ios - 如何使 UIPageViewController 的缓存页面失效?
- javascript - YouTuve IFrame API 与 playerVars 的问题
- dart - Dart 中的“var”和“List”有什么区别?
- javascript - 如何在 React 中使用 three.js
- python - If/Then apply different function depending on each value in array
- arrays - How do I find out if an object is the last in an array (in Swift language)
- python - How to call a ndarray in another function in numpy?
- powerbi - 无法从我的自定义视觉中获得访问 MediaDevice 音频的权限
- python - 用于始终运行脚本的 Python Shell 内存管理