Taming openHAB 2 Logging

Sure enough, that did it. I could have sworn I tried that in my attempts to fix it. Thanks.

Does anyone have any Idea how to get TimeBasedTriggering working?

I replied with my ideas on your original thread. I must have missed it when you first posted.

How do I clear the openhab.log file (not the console log which is explained in the documentation)?
Mine got to 15MB in size during the last install.
Thanks.

rm openhab.log

You just delete it (stop openhab of course before deleting it).

Be aware that it will roll over on its own when the file reaches 16 MB.

Thank you for the reply.

Do I enter

rm openhab.log

That doesn’t work. Or, do I delete the contents of the file manually (or the file)?

Delete the file. But not while OH is running.

But what I was hoping to get across without saying it is:

  • 15 MB is nothing to worry about
  • OH will move the file to openhab.log.1 when the file reaches 16 MB on its own and after it reaches the 9 it will automatically delete the old log files
  • in short, you shouldn’t be worrying about your log files, particularly if you do not have enough experience to be asking these questions in the first place.

I guess I should be looking at console logging for debugging stuff that isn’t working so I’ll leave it alone.

But conversely there are a hell of a lot of posts on here where people are discussing all manner of ways of reducing SD card and USB drive writes to stop corruption including stopping logging all together or logging to an external file server et al.

And they are all focused on moving the logging off of the SD card in the first place. Once the file is written the damage is already done. Deleting a log after it gets (in your opinion) too big does nothing to address this problem. You need to make OH log less, which will buy you maybe a few extra weeks or months before the card dies, or completely move the logging off of the SD card.

Yes, I appreciate that. I do understand the concepts of NAND technology.

What I was trying to do was, as a one-off occasional exercise, reduce the logfile size so, when things were going a bit askew, I wouldn’t have to scroll through pages of old logs to see what had happened that morning, or in the last hour.

Is there a way to exclude dedicated log entries from being created?
For example I have an item CPU_Load which I want to have displayed.
It is updated every second and creates for each item update a log entry. This only spams the log file and I would like to get it out there.

Holger

Hence my link to How to watch and look through logging.

The purpose of the events.log is to log out everything that gets posted to the event bus. So it would be a little counter to the whole purpose of that log file to disable some events. It would give an incomplete picture. Personally, I would either completely turn off events.log rather than prevent it from logging out some events in the first place.

I’ll direct you to the How to watch and look through logging above as well for ways to filter out those lines as you look through the files.

Finally, if you insist, openHAB - Filtering event logs will show how to set regular expression filters to prevent the logger from logging out some events.

@Rich Yes I insist :slight_smile: Thanks for showing me the direction! It works.

Hi

Can someone explain me how to set logging to DEBUG for the TCP-UDP binding, I have tried with

log:set DEBUG org.openhab.binding.tcp-udp
and
log:set DEBUG org.openhab.binding.tcp1

Maby its the name I get wrong?

Best Nanna

Looking at https://github.com/openhab/openhab1-addons/tree/master/bundles/binding it appears the correct package name is org.openhab.binding.tcp.

Great Thanks - it was incorrect package naming - org.openhab.binding.tcp was the correct :slight_smile:

To get the correct name…

  1. login to karaf console
  2. get the feature name
  3. get feature:info
  4. Take a look at the bundle
openhabian@openhab2:~$ openhab-cli console

Logging in as openhab

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.0-SNAPSHOT
                               Build #1502

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> feature:list | grep tcp
openhab-binding-tcp1                        x 1.14.0.SNAPSHOT  x x        x Started     x openhab-addons-2.5.0-SNAPSHOT        x TCP/UDP Binding
openhab> feature:info openhab-binding-tcp1
Feature openhab-binding-tcp1 1.14.0.SNAPSHOT
Description:
  TCP/UDP Binding
Feature has no configuration
Feature configuration files:
  ${openhab.conf}/services/tcp.cfg
Feature depends on:
  openhab-runtime-base 0.0.0
  openhab-runtime-compat1x 0.0.0
Feature contains followed bundles:
  mvn:org.openhab.binding/org.openhab.binding.tcp/1.14.0-SNAPSHOT start-level=80
Feature has no conditionals.
openhab>

the name is between the two slashes :slight_smile:

3 Likes

If you already know part of the bundle name, you can use: bundle:list -s |grep -i tcp as well.