You can add logger to your rules class and log however you want.
Something like:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyClass {
private static final Logger logger = LoggerFactory.getLogger(MyClass.class); // (Or something else)
public void myMethod() {
logger.debug("My log message {} and some other message {}", "My logg message", "some other message");
}
Whatever package you are using (I think) will be used as prefix in openhab when you log.
So you should be able to set log level (debug, error, info) etc with that package in the karaf console.
Look at this: jrule/src/main/java/org/openhab/automation/jrule/internal/JRuleLog.java at main · seaside1/jrule · GitHub
You can also set log level in log4j2.xml typically in ../userdata/etc/log4j2.xml, it is also possible to log to a specific file if you want to do that.