多个Web应用程序的单个日志文件 [英] Single log file for multiple webapps

查看:131
本文介绍了多个Web应用程序的单个日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的tomcat中,部署了多个Web应用程序,它们彼此通信.当前,它们都有自己的日志文件.但是,当呼叫产生问题时,我必须首先检查与之通话的应用程序,并检查该呼叫中涉及的各个应用程序的日志文件.因此,我希望这样做,因为所有应用程序都部署在同一个tomcat中并共享一个通用的log4j,因此,如果对任何应用程序进行了调用,则所有日志都应放在一个日志文件中,无论我的Web应用程序如何参与,所有错误均来自任何Web应用程序通话期间应保存在单个日志文件中.

In my tomcat there are multiple webapps deployed and they communicate with each other. Currently they all have their own log file. But when there is some issue comes from call I have to 1st check with the app to whom I made a call and check log file of respective apps involved in the call. So I want that, as all apps is deployed in same tomcat and sharing a common log4j, if a call made to any app then all logs should be in a single log file and no matters how my webapps are involved all error comes from any webapp during the call should be in a single log file.

我不知道该如何实现.因此,任何帮助都是有意义的.

I have no idea how can I achieve this. So any help is appreciable.

我认为我的问题尚未解决,因此已更新用例:

Edited: I think my question is not cleared so updated with use case:

  1. 我有三个Web应用程序A,B,C,它们的日志文件分别为A.log,B.log和C.log.
  2. 我打了两个电话.第一个到A(内部称为C),第二个到B(内部称为C).
  3. 现在,第一次调用的日志记录必须在A.log中(每个步骤的日志都在webapp c中执行),而第二次调用的日志记录必须在B.log中(每个步骤的日志都在webapp c中执行).

推荐答案

我建议您保留日志文件不变,并使用单独的日志收集器服务.然后,您可以使用该服务进行搜索.另外,您还可以获得过滤器和其他精美功能.

I'd rather recommend that you leave your log files as they are and use a separate log collector service. Then you can just search using that service what you want to know. As an additional bonus, you get filters and other nifty features.

LogStash 是我听说过的好东西.虽然还没有时间使用它,但是我认为这是一个应该去的方向. 首页上有关于它的介绍,入门资料

LogStash is one I've heard good things about. Haven't had the time to take it into use yet, though, but I think that's the direction one should go to. There's a presentation about it on the front page and getting started material here.

免责声明:我与他们没有任何关系,我只是认为这是日志分析应遵循的方向.

Disclaimer: I'm no way affiliated with them, I just think that's the direction log analysis should go to.

这篇关于多个Web应用程序的单个日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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