How To Redirect Logs In OpenDaylight

By default logs are written to karaf.log file in OpenDaylight. If you want to write logs from a specific plugin or a java class to a separate file i.e. a log file other than karaf.log, you need to follow below steps.

Step 1: Define a new file appender

Go to directory karaf/target/assembly/etc

vi org.ops4j.pax.logging.cfg

Add below lines at the end of the file.

So we have added “test” file appender.

Step 2: Configure the catgory

Again open org.ops4j.pax.logging.cfg.

vi org.ops4j.pax.logging.cfg

Add below line at the end of the file:

So all the logs from the package “com.sdntutorials.opendaylight.shape” will now be directed to a new file in karaf/target/assembly/data/test.log

Leave a Reply

Your email address will not be published. Required fields are marked *