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!
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 .
From the karaf CLI you can execute below commands.
To set log levels for particular package.
log:set debug <your package name>
To view logs
log:tail
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.