I have multiple webapps which get deployed on a tomcast server.
In one of my webapp’s log4j.properties, i added the following Socket HUB appender so that the logs are sent to that socket.
log4j.appender.SOCKET=org.apache.log4j.net.SocketHubAppender
log4j.appender.SOCKET.port=9999
log4j.appender.SOCKET.locationInfo=true
Everything gets deployed fine.
My second application’s log4j.properties also has the same appender.
log4j.appender.SOCKET=org.apache.log4j.net.SocketHubAppender
log4j.appender.SOCKET.port=9999
log4j.appender.SOCKET.locationInfo=true
Now if I try to add this second webapplication to the tomcat server which already contains the first web-application, it throws out a “Port already in Use” error in the logs.
However, if i change the port of the second application to 9998, then no error can be seen in the logs. Afaik, the port mentioned here is the reciver’s port and hence it should not be problem if multiple applications use the same reciver port.
Or should I configure this appender in Tomcat’s log4j.properties, but not in every application that gets deployed in it.
Adavanced Thanks
SocketHubAppenderacts as TCP server here and starts listening on given localhost port. Log viewer (Apache Chainsaw, OstrosLogViewer,…) connects to this port and receives/pulls data from.SocketAppender, on other hand, acts as TCP client, connects to given remote server:port and sends/pushes data to.