can someone help me with a little question?
I made some loggers which log to extra files. However, I have now noticed that these loggers are not displayed in the console when I run the log:display command. Is it possible for loggers to write to extra files but still show up in the console? Attached is the log4j2.xml with the loggers I created and are working so far. log4j2.xml.txt (9.6 KB)
Hello Wolfgang,
sorry but I don’t understand your answer. As written in my first post, I created new loggers using log4j2.xml, which log in extra files. See the file attached to my first post. After restarting the openhab service, these extra files were also created automatically. I then used these loggers in small rules.
Here is the content of an example rules file:
rule "Logtest EIN"
when
Item TestItemLogging changed to ON
then
logInfo("EXTRA","Test extra.log EIN")
end
rule "Logtest AUS"
when
Item TestItemLogging changed to OFF
then
logInfo("EXTRA","Test extra.log AUS")
end
If TestItemLogging changes, the corresponding information is also written to the respective log file:
2022-04-26 11:14:18.707 [INFO ] [org.openhab.core.model.script.EXTRA ] - Test extra.log EIN
2022-04-26 11:14:25.913 [INFO ] [org.openhab.core.model.script.EXTRA ] - Test extra.log AUS
I thought I defined the loglevel with the “logInfo” command in my rules. I only want to see the LogInfo output in addition to the log files in the console, and that permanently.
But unfortunately the output in the console remains empty.
prevents that the log message is forwarded to another logger. Thus the console logger will not receive it. Try to change it to “true” in the configuration of your additional loggers, that should yield the desired result.
Hello Stefan,
Thank you for your reply. That was the trick. Now it works!
A small further question, how long are the log entries visible under log:display? I noticed that these are no longer displayed after a short time. Is it possible to extend the display in log:display?
Hello everyone,
I want to bring up this thread again because I still haven’t gotten anywhere. In the meantime I have also created a logger that writes to the standard log openhab.log. My current problem is that the log entries of these loggers are only displayed in the console for about 5 minutes. If I call log:display several times within this 5 minutes, I can see that the entries disappear after 5 minutes. Is there a way to increase this display for this logger to, for example, 48 hours?
other entries are shown for a longer time ?
Just did a test here and I see that about ~500 rows are kept in the “buffer” of log:display.
The oldest entry is nearly 1.5h old.
So I am thinking of if in your case there is a bigger amount of entries that are being logged and this may be why they are not kept that long ?