无法捕获Apache Karaf客户端输出

编程入门 行业动态 更新时间:2024-10-26 18:23:52
本文介绍了无法捕获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/您的文件"

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

更多推荐

无法捕获Apache Karaf客户端输出

本文发布于:2023-10-26 10:58:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529938.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   Apache   Karaf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!