Don’t worry about lost messages with the TCP appender

2010/03/23

As soon as the TCP receiver is configured and started, it tries to connect to the configured TCP appender. Theses connection attempts are repeated every second until the connection is established.

But what happens, if Log4View is already running before the logging application is started. Depending on when the last connection attempt was made, there is a delay of up to 1000 ms until Log4View successfully connects to the newly started application.

Are the messages lost, which had been sent before the connection was made?

No!

The TCP appender is using an internal buffer, which stores the messages of the last 5 seconds and sends them prior to any new messages as soon as a new connection is made. This makes sure, that you don’t lose messages when Log4View is running before you start your logging application. If you start Log4View afterwards, you get at least the last 5 seconds before you started Log4View.

BTW: You also don’t have to worry about long periods where the logging application doesn’t send log messages. The TCP appender sends a short dummy message, if no log messages were sent in the last second. This makes sure, that the TCP connection stays open as long as the logging application and Log4View is running.

Advertisements