在 cmdline 上设置 java.lang.System.Logger 的日志级别
有没有办法在命令行上设置 java.lang.System.Logger 的日志记录级别?使用烘焙到 JAR 中的属性文件是不行的,因为我希望在暂存和生产环境中使用相同的 JAR,但暂存环境具有更详细的日志记录。
Is there a way to set the logging level for the java.lang.System.Logger
on the command line? Using properties files baked into the JAR is a no-go, since I want to have the same JAR in staging and production environments with the difference that the staging environment has more verbose logging.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
java.lang.System.Logger
的每个实现的工作方式都不同,因此没有统一的方法来为所有实现设置它。如果您碰巧使用
SimpleConsoleLogger
,则可以设置环境变量jdk.system.logger.level
。Each implementation of
java.lang.System.Logger
works differently, so there's no uniform way to set it for all implementations.If you happen to use
SimpleConsoleLogger
, you can set the environment variablejdk.system.logger.level
.