如何将 Java 控制台输出通过管道传输到文件? [英] How do I pipe the Java console output to a file?

查看:55
本文介绍了如何将 Java 控制台输出通过管道传输到文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个应用程序中发现了一个完全冻结 JVM 的错误.生成的堆栈跟踪将为开发人员提供有价值的信息,我想从 Java 控制台检索它.当 JVM 崩溃时,控制台被冻结,我无法再复制包含的文本.

I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I cannot copy the contained text anymore.

有没有办法将 Java 控制台直接通过管道传输到文件或其他访问 Java 应用程序控制台输出的方法?

Is there way to pipe the Java console directly to a file or some other means of accessing the console output of a Java application?

更新:我忘了提,没有更改代码.我是一名手动测试员.

Update: I forgot to mention, without changing the code. I am a manual tester.

更新 2:这是在 Windows XP 下,它实际上是一个网络启动应用程序.管道输出

Update 2: This is under Windows XP and it's actually a web start application. Piping the output of

javaws jnlp-url

不起作用(空文件).

does not work (empty file).

推荐答案

其实可以激活tracing.这会将 Java 控制台中的任何内容通过管道传送到跟踪文件中.

Actually one can activate tracing in the Java Control Panel. This will pipe anything that ends up in the Java console in a tracing file.

日志文件将在:

  • /.java/deployment/log on Unix/Linux
  • <用户应用程序数据文件夹>\Sun\Java\Deployment\Windows 上的日志
  • /~/Library/Caches/Java/OS X 上的登录

这篇关于如何将 Java 控制台输出通过管道传输到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆