Lumbermill: Log4j Messaging in NetBeans IDE

In Log4j, Wicket, Tomcat, and NetBeans IDE, I took my first tentative steps in the land of Log4j. Today I found that someone had left a comment at the end of that blog entry, telling me about something I hadn't heard of yet (which is further evidence of the usefulness of blogging) -- a handy GUI that displays all the Log4j messages in NetBeans IDE: Lumbermill plug-in for NetBeans. It's really really really very cool. Really. Here's a screenshot of what it looked like for me, after I'd deployed yet another Wicket sample application:

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 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:

log4j.appender.R.File=C:/.netbeans/4.1/jakarta-tomcat-5.5.7_base/logs/tomcat.log

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...

Comments:

It's not a plugin for NetBeans, but you might want to look into Chainsaw V2 from the log4j folks: http://logging.apache.org/log4j/docs/chainsaw.html

Posted by Scott on July 06, 2005 at 01:08 AM PDT #

Interesting, thanks. (And, even though it's not a plug-in, it could be integrated into the IDE via an Ant script -- the only difference with the integration of the Lumbermill plug-in would be that Chainsaw V2 isn't docked in one of the IDE's tabs...)

Posted by Geertjan on July 06, 2005 at 06:03 AM PDT #

Hi Geertjan, the cool thing of my lumbermill plugin (I did not write lumbermill. I just wrapped the plugin code around.) is, that I used your tutorials and demo code to code it. And now you write about it in your blog. That's cool, isn't it. Have fun Thorsten

Posted by Thorsten Hell on July 10, 2005 at 07:06 PM PDT #

Yes, that is really cool! Actually, the same is true for Thinlet (http://thinlet.sourceforge.net), except that I haven't blogged about Thinlet yet... Thanks for your message -- and please don't forget that the next release will have a lot of wizards and other GUIs that will really simplify plug-in support. Several tutorials are already available in draft form -- http://platform.netbeans.org/tutorials.

Posted by Geertjan on July 10, 2005 at 07:11 PM PDT #

It would be cool to see Chainsaw as a plugin for Netbeans? I don't know anyting about writing plugins, but guess it would be a snap for a guy like Geertjan

Posted by Søeren on January 04, 2007 at 04:41 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« May 2015
SunMonTueWedThuFriSat
     
2
3
8
9
10
19
26
27
28
29
30
31
      
Today