LoggingDemo
From Whole Brain Catalog
Contents |
[edit] Logging Demo
This document will describe the developer example relating to the use of SLF4J and Log4J in a simple demo example. Slides that explain the technologies used here are available here.
[edit] How to Install
[edit] From Eclipse
I. First, install and download eclipse and the Maven Plugin Instructions Here.
- Checkout a new project from SVN; http://wholebrain.googlecode.com/svn/logging-demo/trunk.
- Window->Show View->Other...
- Choose SVN->SVN Repository.
- Right click within the SVN Repository View that comes up and click New->Repository Location...
- put: https://wholebrain.googlecode.com/svn/ If asked about a digital certificate, Accept Permanently.
- Navigate down to, and right click on the logging-demo/ folder and choose Checkout...
- You will be prompted to check out the project. Choose "Check out as a project configured using the New Project Wizard".
- In the "New Project" window that pops up, select Java->Java Project and hit Next.
- In the next window, pick a project name you like (for example, "LoggingDemo")
- Click "Finish" and hit OK to any windows that popup.
- Right-click on the project, and from the Maven submenu, click "enable dependency management".
- Right click on the project and look at Build path...->Java Build Path->Libraries tab. Click on the arrow to open up the JRE system library. Make sure this is pointing to a jdk 1.5 that is loaded on your machine. If it isn't, then press the Add Library... button and install a new JRE System library that does point to 1.5. On windows, its usually under C:\Program Files\Java. If you can't find a 1.5 JDK, you'll need to download it.
- Create a new run configuration.
- Select Run > Run Configurations:
- Under "Maven", create a new run configuration. Name it "clean install". Make the workspace the root under your new project. In the box called "goals" type "clean install". Run this.
[edit] How to Run
[edit] From Eclipse
Under eclipse, right click on the folder containing LoggingDemo.java. Scroll down and under the "Run As" option click on "Java Application".
[edit] From a command line
We use Maven to build our code. The first thing to know about Maven is that it provides the "single command" ability to build an entire code base. With SVN and Maven installed you can issue the following commands to download and build the entire source:
svn co http://wholebrain.googlecode.com/svn/logging-demo/trunk LoggingDemo cd LoggingDemo mvn clean install
The one caveat to this is that you need to place a single configuration file called settings.xml in your Maven directory. Your Maven directory is located at ~/.m2 on linux/mac, C:\Users\[username]\.m2 on Vista, and C:\Documents and settings\[username]\.m2 in Windows XP. You can download our copy of the settings.xml file here.

