[HTTP-Binding] Permanent disable Logging?

Could you guys tell me how to permanent disable the logging of the http-binding in openHab-2.2.0-Snapshot?
In the Karaf-Console i can disable with “log:set ERROR org.openhab.io.net.http.HttpUtil” but I already tried in the “/opt/openhab2/userdata/etc/org.ops4j.pax.logging.cfg” putting a line with “log4j.logger.org.openhab.io.net.http.HttpUtil = ERROR” but this doesnt work. Could you please tell me a way how to do this in the config-files?

I want to disable it as I get many errors if a address is not reachable but should be included in the sitemap anyway.

Thank you in advance =)

You could put it in a different file and NOT have it go into openhab.log with:

# http logger
log4j.logger.org.openhab.binding.http = ERROR, http, osgi:*
log4j.additivity.org.openhab.binding.http = false
log4j.appender.http.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n

Thank you @sipvoip,

So a possible solution could be to redirect the log-path to /dev/null. :smirk:

It doesn´t work as expected. I´m still getting the Log-Entries of the HTTP-Binding in my openhab.log-file. Even after redirecting it with your syntax to /dev/null/http.log (nirvana). :disappointed_relieved:

If you added the lines that Nathan wrote in /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg (especially this):

log4j.additivity.org.openhab.binding.http = false

you shouldn’t be getting log entries in openhab.log

can you post the log entry that you see in openhab.log?

You could also raise log level to:

log:set FATAL org.openhab.binding.http

Sure, here´s the log I´m still seeing in openhab.log:
2017-07-11 07:07:01.544 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:11.707 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:11.720 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:21.856 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:21.875 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:32.012 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT
2017-07-11 07:07:32.033 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 409 CONFLICT

I just realized that you should not be modifying the log levels for the http binding (org.openhab.binding.http) but rather for the I/O network http bundle (org.openhab.io.net.http)…

# http I/O logger
log4j.logger.org.openhab.io.net.http = ERROR, httpio, osgi:*
log4j.additivity.org.openhab.io.net.http = false
log4j.appender.httpio.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n

This will send all ERROR (and higher) log entries to httpio.log. If you don’t want to log ERRORs, raise the level to FATAL:

log4j.logger.org.openhab.io.net.http = FATAL, httpio, osgi:*

or for console:

log:set FATAL org.openhab.io.net.http.HttpUtil

this will shut up the log entries (even if they are errors) :slight_smile:

I think that the log levels are: <TRACE, DEBUG, INFO, WARN, ERROR, FATAL> (from the most to less verbose). DEFAULT usually is INFO (this is defined per bundle)
The docs entry doesn’t have the FATAL one but has OFF: http://docs.openhab.org/administration/logging.html#defining-what-to-log
Maybe you can try OFF also.

Anyway, you should try to fix the root cause of the 409 :stuck_out_tongue:

Thank you so much =) It works now.

I cannot fix it as i wanna see the status of my 3d-printer in openhab via Json-transformation. But if its offline, I get those 409.
I´ve got no idea how to check only for the status if its turned on exepct someone writes a binding for it :slight_smile:

how about a network binding?
check the IP if it’s online

sure, but how can i enable a item only when a switch is turned on (eg. via network binding)?

one (crazy) way would be: write a rule that creates (copies over from another dir to the items dir) an *.items file with your http bound 3dprinter when the switch is on

remove the file (or overwrite it with an empty one) when switch goes off (again with a rule that calls upon an exec bound item that essentially runs a script). In theory, the http bound 3dprinter item should go away from OH2. If not, you could issue a OH2 console command from the script to remove the item.

with exec binding you could issue any command to the host (or send REST calls to do the same: add/remove item)

this is a kinda of stupid method and I am sure that there are better ways that other people will recommend :slight_smile:
I am simply on my first cup of coffee :stuck_out_tongue:

Thank you. I don´t got such a solution in mind. That´s no bad idea. I can create a bash-script which switches between 2 files. One with the items and their http-channels and json-transform and the other with only the items (so i don´t receive errors about missing items if i visit the sitemap).

maybe the REST API is a better way to achieve the same result (add/remove item from OH2)