It would be great (and should not be a big effort) to create a log4j tcp appender. With this, it would be very easy to use a good logging tool like http://code.google.com/p/otroslogviewer/ out of the box. (otroslogviewer supports tcp log4j streams, but no udp.)
It should be possible to add this. However, first I would like to know if there is any description of the protocol/payload formatting on the stream?
Is it his: http://logging.apache.org/log4j/2.x/manual/layouts.html#XMLLayout
Actually, I can already make it work, when forwarding the udp stream to tcp with socat:
Logger:
http://code.google.com/p/otroslogviewer/
Tools -> start socket listener -> config "log4j xml" + port "8080"
Source code:
uncomment in hal/baselogger.cpp:
#include <log4cplus log4judpappender.h="">
log4cplus::helpers::SharedObjectPtr<log4cplus::Appender> networkAppender(new log4cplus::Log4jUdpAppender("localhost", 8080));
log4cplus::Logger::getRoot().addAppender(networkAppender);
Udp -> TCP:
http://www.dest-unreach.org/socat/
(windows: http://blog.gentilkiwi.com/programmes/socat#englishversion)
command:
socat -v udp4-listen:8080,fork tcp:localhost:8080
I guess this should make it pretty straightforward to adapt the existing log4j udp logger to use tcp...
I just looked at the source code: Basically, taking the "socketappender.cxx", renaming it to "log4jtcpappender.cxx" and replacing (in the append function) this:
helpers::SocketBuffer buffer(LOG4CPLUS_MAX_MESSAGE_SIZE - sizeof(unsigned int));
convertToBuffer (buffer, event, serverName);
helpers::SocketBuffer msgBuffer(LOG4CPLUS_MAX_MESSAGE_SIZE);
with this from the log4judpappender.cxx append function:
should be enough to make it work...
Would a patch help to speed things up? It would be great to have this functionality, and I don't think its a lot of work. But I can try to do it myself maybe...