Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is logging to a message queue a good idea?

Currently I'm facing the problem to aggregate several log files from a distributed system.

But since most of the applications are Java applications which use both log4j and all of them use JMS I thought about logging directly into a message queue instead of copying the individual log files.

Is this a good idea or can this backfire somehow?

like image 822
Daniel Rikowski Avatar asked Sep 16 '11 13:09

Daniel Rikowski


People also ask

What are the disadvantages of message queue?

Disadvantages of message queues They are both one-to-one in nature: they transmit information from one sender to one recipient. Like a caller of an RPC, the message sender has some idea about the system for which the message is intended. A queue is not a broadcast mechanism.

Is message queue necessary?

Message queues provide communication and coordination for these distributed applications. Message queues can significantly simplify coding of decoupled applications, while improving performance, reliability and scalability.

What are the benefits of using a queue?

Advantages of Queue: A large amount of data can be managed efficiently with ease. Operations such as insertion and deletion can be performed with ease as it follows the first in first out rule. Queues are useful when a particular service is used by multiple consumers.

Do message queues increase complexity?

Message queues will add complexity even if incrementally.


1 Answers

A couple of loose ideas:

  • performance was already mentioned — turning on detailed debug information may prove impossible in production environment (if it turns out you need to trace for a deeply hidden error),
  • you lose log4j's roll-over behaviour, you have to implement it yourself at the point where you collect log statements,
  • add process/machine specific info to log lines (unless it's obvious otherwise which application issued which log line),
  • consider adding an incrementing counter of log lines in every application if you absolutely need to know the order in which log statements were issued — message delivery order is not guaranteed and time stamp in log4j is only at millisecond increments,
  • efficient analysis of such bulky file may require good (and paid, or even custom-written) log viewers.
like image 127
MaDa Avatar answered Sep 19 '22 21:09

MaDa