如何将控制台日志重定向到 Mac OS X 中的 Java Web Start 文件?
可能的重复:
将 java web start 应用日志重定向到文件
如何将控制台日志重定向到 Mac OS X 中的 Java Web Start 文件?我正在将应用程序作为 Java Web Start 运行,并且需要保留控制台数据;当应用程序关闭时,其控制台也会随之关闭。有没有办法将控制台输出重定向到日志文件?
目前,我在调试时让应用程序保持打开状态,但最好针对意外情况进行设置。
Possible Duplicate:
redirecting a java web start app logs to a file
How do you redirect the console log to a file for Java Web Start in Mac OS X? I am running an application as a Java Web Start, and I need the console data to persist; when the app closes, its console goes with it. Is there a way to redirect the console output to a log file?
For now, I am having my application stay open while I debug, but it would be nice to set this up for the unexpected.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
事实证明,答案来自 How do I Pipe Java 控制台输出到文件? 确实有效,但日志位于 OS X 下的以下位置(我没有在任何地方找到记录):
/~/Library/Caches/Java/log
It turns out the answer from How do I pipe the Java console output to a file? does work, but the log goes in the following location under OS X (which I have not found documented anywhere):
/~/Library/Caches/Java/log
如果其他人碰巧遇到这个问题,我会提供其他有趣的信息。
以下链接包含有关在 OS X 上部署的其他信息: http://www.ks .uiuc.edu/Research/biocore/javawebstart.shtml
并建议在“~/.java/.deployment”中设置包含以下条目的deployment.properties文件:
这样,而不是~/Library/Caches/Java/log 你会得到你想要的。
If others happen to get into the problem, I'll let this other interesting bit of information.
The following link has additional information for deployment on OS X: http://www.ks.uiuc.edu/Research/biocore/javawebstart.shtml
and advises to set up in ‘~/.java/.deployment‘ the deployment.properties file with the following entries:
This way, instead of ~/Library/Caches/Java/log you get what you wish.
更好的方法是使用 SL4J ( http://www.slf4j.org/ ) 或其他记录器库。
and better way is using SL4J ( http://www.slf4j.org/ ) or other logger library.