Search code examples
socketsserverlog4cplus

Log4cplus: SocketAppender logging server


I wish to better understand the way the Log4cplus SocketAppender works with regard to the logging server that recieves this appender events.

I read the Log4cplus src code for loggingserver and socketappender and I will be glad to be clarified:

Can the SocketAppender only send events to the Log4cplus logging server, and not to any other server? and if this is the case: does it mean that if I want to send log messages to remote machine, that machine must be installed with the Log4cplus lib?

I would also like to know- does this Log4cplus logging-server run as a service? and does it require special configuration and pre-setup in order to use it?


Solution

  • Can the SocketAppender only send events to the Log4cplus logging server, and not to any other server?

    Yes and yes.

    does it mean that if I want to send log messages to remote machine, that machine must be installed with the Log4cplus lib?

    Well, sort of. If you want to use only SocketAppender, you will have to use the logging server. You could also use SysLogAppender and send to remote server using that. Obviously, you have to have syslog service and allow receiving from network in it. You could also write your own custom appender that sends the events to whatever server you desire.

    I would also like to know- does this Log4cplus logging-server run as a service?

    No, it is a simple executable that listens on a socket.

    and does it require special configuration and pre-setup in order to use it?

    It requires configuration file so that it knows where to log the events.