Redirecting the shell output to a file [duplicate]

旧时模样 提交于 2019-12-20 04:50:57

问题


I am working on AIX 6 where I am running a java command on a Korn Shell and I am trying to debug the class loading issue. I put -verbose:class to print the class loaded and then >>/home/user/log.log to get the console out put in a file. The log.log file is got created but its of zero size. File is not containing any information and all the verbose details are ripping through the screen in a flash.

/usr/IBM/WebSphere/AppServer/java/bin/java -verbose:class -cp "XXXXX" com.ibm.XXXX >>/home/user/log.log

回答1:


Try redirecting stderr also:

/usr/IBM/WebSphere/AppServer/java/bin/java -verbose:class -cp "XXXXX" com.ibm.XXXX >>/home/user/log.log 2>&1

Your Java code might be writing on stderr that your command isn't redirecting.



来源:https://stackoverflow.com/questions/21602441/redirecting-the-shell-output-to-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!