前提:在测试过程需要关注多个 tomcat 的多个实时日志
老方式:打开多个 ssh 回话,分别 tail -f 不同路径下的不同日志
问题:虽然输命令也不是很慢,但重复的输命令也麻烦啊;不知道为什么 xshell 一天会断掉大概两次连接,就得再输命令打开日志
一种解决方式:网上搜了才发现,可以 tail -f 多个日志,这样就可以同时查看多个日志了;但是仍存在问题,有些操作会刷出来很多日志,看着有点不方便;tail -f 后写多个路径也有多,最好这一步也省去
问题:有没有可以便捷实时查看多个日志的方法或者工具
log.io 推荐给你
额,其实 tail -f 多个日志也差不多能满足我的需求了,就是想找个再好用的方法。。。
是个点子,然而已有技能不足以支撑我搞起这个网站,回头我细细看看,当前想直接用现成的
刚发现 xshell 有分屏的功能,虽然仍没有解决我的问题,但这个功能也很好用啊
用 perl 写过一个实时监控文件变化的。
用的是 File::Tail 这个模块。
其他语言应该也有类似的实现。
懂你的意思了,alias 会便捷点,但是本质上还是 tail -f 多个日志,还存在日志输出过多不方便查看的问题
log.io 推荐给你
安装的时候遇到问题啦,能帮忙看看报错咋解决不
[root@localhost ~]# cnpm install -g log.io --user 'root'
Downloading log.io to /usr/local/lib/node_modules/log.io_tmp
Copying /usr/local/lib/node_modules/log.io_tmp/_log.io@0.3.4@log.io to /usr/local/lib/node_modules/log.io
Installing log.io's dependencies to /usr/local/lib/node_modules/log.io/node_modules
[1/9] underscore@~1.4.3 installed at node_modules/_underscore@1.4.4@underscore
[2/9] backbone@~0.9.10 installed at node_modules/_backbone@0.9.10@backbone
[3/9] coffee-script@~1.4.0 installed at node_modules/_coffee-script@1.4.0@coffee-script
[4/9] jquery-browserify@~1.8.1 installed at node_modules/_jquery-browserify@1.8.1@jquery-browserify
[5/9] winston@~0.6.2 installed at node_modules/_winston@0.6.2@winston
[6/9] express@~3.0.1 installed at node_modules/_express@3.0.6@express
[7/9] socket.io-client@~0.9.11 installed at node_modules/_socket.io-client@0.9.17@socket.io-client
[8/9] socket.io@~0.9.13 installed at node_modules/_socket.io@0.9.19@socket.io
jquery@1.8.3 › contextify@~0.1.3 found binding.gyp file, auto run "node-gyp rebuild"
make: Entering directory /usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify/build'
/usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify/build'
CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc: In static member function ‘static v8::Local<v8::Context> ContextWrap::createV8Context(v8::Local<v8::Object>)’:
../src/contextify.cc:131:68: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance() const’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3851): Use maybe version [-Wdeprecated-declarations]
Local<Object> wrapper = Nan::New(constructor)->NewInstance();
^
../src/contextify.cc:150:16: error: ‘class v8::ObjectTemplate’ has no member named ‘SetAccessCheckCallbacks’
otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
^
../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyGetter(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&)’:
../src/contextify.cc:182:80: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
^
../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyQuery(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Integer>&)’:
../src/contextify.cc:209:67: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
^
../src/contextify.cc:210:71: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated (declared at /root/.node-gyp/8.11.2/include/node/v8.h:3403): Use maybe version [-Wdeprecated-declarations]
!Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
^
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
make: Leaving directory
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/cnpm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.10.0-123.el7.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/cnpm/node_modules/npminstall/node-gyp-bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/_contextify@0.1.15@contextify
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Install fail! Error: Run "sh -c node-gyp rebuild" error, exit code 1
Error: Run "sh -c node-gyp rebuild" error, exit code 1
at ChildProcess.proc.on.code (/usr/local/lib/node_modules/cnpm/node_modules/runscript/index.js:74:21)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npminstall version: 3.5.0
npminstall args: /usr/local/bin/node /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/root/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org -g log.io --user root
https://blog.csdn.net/shootyou/article/details/48347847,参照这个进行安装的,前几步遇到好几个坑,到这一步实在走不动了。。。求帮助
同样遇到这个问题,google 有说切换用户的,有说降低 node 版本的。难道 node 的版本这么弱鸡,不向下兼容?之前安装 stf 也是一堆编译错误,降了 node 版本才搞定的。node 的包管理机制真是蛋疼。
。。。我折腾了好久,试了了好多个版本,用 v4.9.1 这个版本才行。。。