[SOLVED] Names of loggers?

First, I’m not sure this is the best place for this. Please feel free to move it or ask me to move it if there is a better place!

I’m fighting an issue on my OH2 installation where something just quits working.

I’d like to have more information before I post saying, “This just stops reporting.” That’s not a very helpful discussion!

I also see many threads say things like, “Turn up the debug and see if there are messages”.

I’d love to do that!

I know part of it: In the karaf console, log:set will let me set the debug level for various loggers. I understand the different levels - I’ve worked with Log4J before - and can see a few of the logger names in the output of log:get.

In the logs themselves, I can see what is being logged, and a truncated part of the logger name, but not enough to know what to turn up or ddown.

I found Logging | openHAB which describes how the log files are set up and has some more logger names, but nothing for any of the bindings I’m struggling with.

How can I get the full name of the logger so I can set the levels?

How can I find the names of other loggers so I can turn them up to see if I can get more information about the problem I’m seeing before I have to bother people on the forum?

Is there a way to get the logger to files or karaf to stop truncating the logger name? Or do I get to install a full development environment to try and figure out where these messages are coming from? (Yay, Open Source! That option exists if that’s what is required!)

Any guidance on how to figure out what loggers to enable and turn up to try and find an issue?

Any help is appreciated, because I’d like to feel like I understand why this problem happens or at least where the problem is before I go asking for more help!

In general, you can list all the bundles using this command in the console.

list -s

Is there a specific binding that’s causing you trouble, or something more systemic?

2 Likes

The log file config is located in /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg.

You can usually guess at the truncated part of the binding because they are all in the same packages for the most part.

org.openhab.binding.<binding name>

Usually the “binding.<binding name>” part gets preserved.

There are a few bindings that will be in the org.eclipse.smarthome.binding.<binding name> path but that should be changing over the coming weeks or months if it hasn’t already.

Since you are familiar with log4j, you are aware that you can specify the format of the log lines through the logger config file so that is one way to get the full package name.

Usually what I’ll do is I’ll configure a separate logger and appender for the binding I am debugging and configure it to log at debug or trace level to it’s own file.

A good example can be found at Log4j2 Sample Config

1 Like

I’d found the list of bundles, but haven’t found that it gets me the diagnostics I’m looking for. Maybe what I’m trying to find isn’t as straightforward as hoped.

The idea of configuring a new file to work on that issue I’m following is a good one, and I think will let me manage that more easily than having to go into Karaf and log:tail. I seem to find the grep in karaf doesn’t always apply, or crashes, and karaf keeps closing the connection. tail -f will be simpler and give me back all the unixy command line tools that I know so well.

Thanks for the tips, and I’ll see if those don’t get me closer to understanding what’s happening!

Hi! i just want to supress log data from loggers below. I supouuse that in [] bracket not full logger name. Where i can find full name and add it to org.ops4j.pax.logging.cfg file with ERROR level.

6:20:46.513 [WARN ] [generic.internal.generic.ChannelState] -
16:17:46.334 [WARN ] [al.generic.ChannelStateTransformation]

Your best bet is probably to temporarily modify the formatting for that logger to not truncate the class name. I searched the openHAB project on github and neither classname appears. Do you have any “unofficial” add-ons installed?

This is warning when json transformation did not find correct path in incoming value in mqtt json packet

this is full part of log record

2019-12-12 14:28:46.384 [WARN ] [l.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.sds.pm25' in '{
  "state": "OFF",
  "powerOn": "OFF",
  "DC5V1On": "OFF",
  "DC5V2On": "OFF",
  "night": "OFF",
  "brightness": 255,
  "effect": "solid",
  "frame": "ON",
  "color": {
    "r": 255,
    "g": 255,
    "b": 255
  },
  "bme280": {
    "temp": 28.99,
    "humi": 28.34473,
    "press": 748.6241
  },
  "ccs811": {
    "CO2": 600,
    "TVOC": 30
  }
}'
2019-12-12 14:28:46.439 [WARN ] [eneric.internal.generic.ChannelState] - Incoming payload '{
  "state": "OFF",
  "powerOn": "OFF",
  "DC5V1On": "OFF",
  "DC5V2On": "OFF",
  "night": "OFF",
  "brightness": 255,
  "effect": "solid",
  "frame": "ON",
  "color": {
    "r": 255,
    "g": 255,
    "b": 255
  },
  "bme280": {
    "temp": 28.99,
    "humi": 28.34473,
    "press": 748.6241
  },
  "ccs811": {
    "CO2": 600,
    "TVOC": 30
  }
}' not supported by type 'NumberValue'

Well, that error is reasonable. Your JSONPATH is looking for elements that do not exist in that JSON String. There is no sds element.

Exactly. I know this, but I want to switch this logger to Error. Now this logger have WARN level. But where I can find logger name, in this log the name truncated? May be cfg file have some options for show full logger name?

I don’t know. That’s why I said you should change the formatting on the logger so it prints the full class name. I tried a search for any class by either of those names and couldn’t find them anywhere in the OH project repos.

If you are using the MQTT 2.5 M1 or later binding, you can prevent the error in the first place using MQTT 2.5 M1+ How to implement the equivalent to MQTT1 REGEX filters

1 Like

I know about regex problem in version below 2.5m1. I try to update to 2.5m4 and have got too many errors. I will wait for 2.5 stable version and hope this resolve my problem. Thank you for answers.