3

I created a project using MD-SAL Startup Archetype and added some debug logs to check the code. The project is compiled and installed successfully. But after running karaf and log:display, I can't seem me to find any of the logs I entered. I'm new using ODL and probably am missing something. Can someone help me on how to search for the logs I need? For example, I read somewhere that we can do setLogLevelorg.opendaylight.bundlename TRACE or DEBUG for a specific bundle but in my case, the startup archetype created a folder containing several other from api, features, karaf to impl folders. I added code mainly in the impl folder and created different classes, each of these classes have debug logs that I wanted to check, so how do I specify the bundle name and path in this case? And where should I use that code? Because in the karaf console I can only do log:list, log:display DEBUG, etc. I'm sorry if this a confusing question but would appreciate any help.

Thanks!

Sfmar
  • 159
  • 1
  • 13

2 Answers2

4

It is not a bundle name you specify with the set log level command but a fully-qualified Java package or class name. You can also just edit etc/org.ops4j.pax.logging.cfg directly to set the log levels for packages/classes, for example:

log4j.logger.org.opendaylight.mypackage=DEBUG

In code you create Logger instances per class, for example:

package org.opendaylight.mypackage;

public class MyClass {
    private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
    ...
}

Log output goes to data/log/karaf.log.

Tom Pantelis
  • 1,349
  • 1
  • 7
  • 6
2

From the karaf CLI you can execute below commands.

  1. To set log levels for particular package.

    log:set debug <your package name>
    
  2. To view logs

    log:tail
    
Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112