Classpath Setup

In order to run the examples provided in the documentation, you need to add the following jars to your class path:

Example

Assuming your current directory is $LOGBACK_HOME/logback-examples, where $LOGBACK_HOME stands for the directory where you installed logback, you can launch the first sample application, chapter1.HelloWord1 with the following command:

java -cp
 lib/slf4j-api-1.4.3.jar;../logback-core-0.9.8.jar;\
 ../logback-classic-0.9.8.jar;logback-examples-0.9.8.jar\
 chapter1.HelloWorld1

It is more convenient to set the CLASSPATH environment variable once and for all before running the examples.

The setClasspath.cmd script located in the $LOGBACK_HOME/logback-examples folder will configure the class path for the MS Windows platform. For Unix, you can use setClasspath.sh.

Please edit the script in order to adapt the LB_HOME variable to match your local environment.

Please be aware that many examples will launch java classes along with configuration files. To access these files by using the same commands as written in the documentation, you will need to issue the commands from within the $LOGBACK_HOME/logback-examples directory.