无法捕获 Apache Karaf 客户端输出 [英] Can't capture Apache Karaf client output

查看:30
本文介绍了无法捕获 Apache Karaf 客户端输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 CentOS 6.5 中使用 $KARAF_HOME/bin/start 在服务器模式下启动了 Apache Karaf 3.0.0.然后我想使用 $KARAF_HOME/bin/client 运行几个命令并捕获这些命令的输出,以确保命令成功运行.输出确实在我的控制台上吐出,但我永远无法将其重定向到文件中.似乎 Karaf 没有向输出流或错误流写入任何内容.我尝试了以下方法:

I started Apache Karaf 3.0.0 in server mode using $KARAF_HOME/bin/start in CentOS 6.5. Then I wanted to run several commands using $KARAF_HOME/bin/client and also capture the output of these commands, so as to make sure the commands ran successfully. The output did get spit out on my console but I was never able to redirect it into a file. Seems like Karaf doesn't write anything to the output stream or error stream. I tried the following:

[apache-karaf-3.0.0]$ ./bin/start clean
[apache-karaf-3.0.0]$ ./bin/client "bundle:list"
Logging in as karaf
282 [pool-2-thread-3] WARN org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier - Server at /0.0.0.0:8101 presented unverified key:
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version                 | Name
------------------------------------------------------------------------------------
 91 | Active |  80 | 1.8.0                   | Commons Codec
 92 | Active |  80 | 2.6                     | Commons Lang
 93 | Active |  80 | 15.0.0                  | Guava: Google Core Libraries for Java

[apache-karaf-3.0.0]$ ./bin/client "bundle:list" >& bundleList
[apache-karaf-3.0.0]$ cat bundleList
null

没有写入文件bundleList.管道输出似乎也无济于事.

Nothing got written to the file bundleList. Piping the output doesn't seem to help either.

推荐答案

要使 Aviv 的解决方案起作用,只需使用管道,例如"bundle:list | tac -f/tmp/yourfile"

To make Aviv's solution work, simply use a pipe, e.g. "bundle:list | tac -f /tmp/yourfile"

这篇关于无法捕获 Apache Karaf 客户端输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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