Lumbermill: Log4j Messaging in NetBeans IDE
By Geertjan-Oracle on Jul 05, 2005
After that, though, you'll need to know a little bit more about the log4j.properties file (everything I know about this I learnt here), otherwise you'll still not have found what you're looking for. This file, which -- if you've followed the instructions here -- is found in Tomcat's common/classes folder, has a log4j.rootLogger entry, right at the top. The rest of the file consists of entries that start like this: log4j.appender. It is important to know that each of the appenders is defined by the log4j.rootLogger entry. So, for example, in this log4j.properties file, you'll find that an appender with the name "R" has been defined. Subsequently, the file contains entries such as the following:
This tells Log4j where to put the output of the R appender, which is supplied by org.apache.log4j.DailyRollingFileAppender. For Lumbermill, I've learnt, you need the following entries in the log4j.properties file:
log4j.appender.LogServer=org.apache.log4j.net.SocketAppender log4j.appender.LogServer.Port=4445 log4j.appender.LogServer.RemoteHost=localhost
But, to activate the above entries, you'd need to add the appender to the log4j.rootLogger entry. (And, to activate the output of logging message to the Output window for this log4j.properties file, you'd need to append "A1" to the same entry too.) So now my log4j.rootLogger entry looks as follows:
log4j.rootLogger=INFO, R, A1, LogServer
After making these changes to the log4j.properties file, I not only received Log4j messages in the IDE's Output window, but also in the Lumbermill GUI. (And, on top of that, the Log4j messages appeared in my log file too.) Pretty cool. And remember that I'm only using it to view my local logging messages -- using the log4j.appender.LogServer.RemoteHost entry, I can also view my remote Log4j messaging. Lumbermill rocks. Now, apparently, there's also something called Sawmill? Hmmm. Let's look into that...