This tip helps you to setup the Log4j in NetBeans IDE.


However, it took a bit of work to set up. Getting the plug-in is easy, just go to the NetBeans-Lumbermill site. Then, if you haven't already done so, set up Log4j exactly as described here.

After that, though, you'll need to know a little bit more about the 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 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 file:

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 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 file, I did not only receive 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...