java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4084
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
Log4j Messaging in NetBeans IDE E-mail
User Rating: / 19
PoorBest 

Introduction

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

Details


Image

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


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.