Redirecting the shell output to a file [duplicate]

2019-02-28 06:52发布

This question already has an answer here:

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条回答
倾城 Initia
2楼-- · 2019-02-28 07:18

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.

查看更多
登录 后发表回答