Discussion:
[問題] 想把Exception的stacktrace給印到檔案中
(时间太久无法回复)
unknown
2007-02-24 04:18:03 UTC
Permalink
試了在winXP的command line下面用>作pipe,但是沒catch到的Exception還是
直接顯示在螢幕上……
請問有什麼辦法可以在winXP中執行jar檔時把Exception的stacktrace給傾印到
某個檔案中嗎?

--
http://blog.xuite.net/romulus/main

my blog, for Baseball, ACG, MAGIC-Mahjong-Go, and not suggested to read,
FlameFight.

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.169.81.97
小安
2007-02-24 07:06:20 UTC
Permalink
�� �ޭz�mRomulus (S��ubern Mode)�n���ʨ��G
: �դF�bwinXP��command line�U����>�@pipe�A���O�Scatch�쪺Exception�٬O
: �������ܦb�ù��W�K�K
: �аݦ��������k�i�H�bwinXP������jar�ɮɧ�Exception��stacktrace���ɦL��
: �Y���ɮפ��ܡH

�����i�H�N error output redirect

java Foo 2> output.txt



--
�� �o�H��: ���������~�{(ptt.cc)
�� From: 123.194.148.184
unknown
2007-02-24 13:29:57 UTC
Permalink
以上兩者(1> 2> 和 SetOut、SetErr)都可正確達到所需效果;
感謝兩位!

--
http://blog.xuite.net/romulus/main

my blog, for Baseball, ACG, MAGIC-Mahjong-Go, and not suggested to read,
FlameFight.

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.169.81.97
a***@kkcity.com.tw
2007-02-26 02:38:46 UTC
Permalink
Post by 小安
�������ܦb�ù��W�K�K
�аݦ��������k�i�H�bwinXP������jar�ɮɧ�Exception��stacktrace���ɦL��
�Y���ɮפ��ܡH
����, �����򤣥ΦU���� logging library (Log4J, Java Logging etc)?
catch �� exception ���g logging library �L�X�Ӥ��O����
printStackTrace()

������ redirect �ä��O�ܦn�� practice

Alien
--
�z�w�w�w�w�w���٢٢Ѣע������w�w�w�w�w�{ ���@��  �� �u�W���ַs�_�� �� ���@��
�x bbs.kkcity.com.tw �x ^_^ /  �H���H���K����  KKBOX��  ^_^ / 
�|�w�w�mFrom:202.72.0.45 �n�w�w�}  �@ �� http://www.kkbox.com.tw �@ ��
--

Loading...