Thursday, March 4, 2010

View debug/log information inside Eclipse with NTail

Implementing Debugging and Logging functionality in your application will help you a lot when tracing the details of an error - while developing and also after deployment.
There are lot of libraries out there like log4j, which you can integrate with your app for easier log management. Log4j/log4net have the provision to either log the information to a file or send email.
So, will it be helpful if you can directly see the logs in Eclipse that will get updated whenever the log file gets updated ?

Using NTail, you can achieve this. The content of the log file will be shown in a window inside Eclipse which will automatically get updated.

Steps:


  1. Download latest version of NTail from the website http://www.certiv.net/downloads/ntaildownload.html.
  2. Now copy the .jar file to the 'Plugins' directory inside the Eclipse installation folder.
  3. Open Eclipse
  4. Go to Window -> Preferences.
  5. In the Preferences window you can see the 'NTail' section (If NTail is not listed there, your version of Eclipse may not have support for the version of NTail).
  6. Expand the NTail section and select 'Define Viewers'.
  7. Click 'New' and give the details of the log file and a name.
  8. Click 'OK' and you have successfully setup the NTail to watch a file for changes.
  9. Now, go to Window -> Show View -> Other.
  10. Select NTail from Logging -> NTail. Alternatively, you can type 'NTail' in the filter text box on top of the window.
  11. Click 'OK'.
  12. The NTail window should open inside your Eclipse.

Now, whenever the file gets changed, it will be shown inside the NTail window.

No comments: