[SOLVED] Escaping Characters From Log Reader Binding For executeCommandLine

  • Platform information:

    • Hardware: RPi4
    • OS: OpenHABian
    • Java Runtime Environment: stock
    • openHAB version: 2.5.1
  • Issue of the topic:

Hi - I’m trying to find a good, universal way to properly capture basic information from the Log Reader binding, and post it to Slack using executeCommandLine. The logging is working, as is the slack posting, but the two of them do not cooperate as I believe there are too many characters that need to be escaped in the log entries.

I would like to either simplify the log entry, or properly escape any character that shows up in the log entry, as if the log entry causes an error, I end up in an infinite error-generating loop. :frowning:

I’ve spent some time looking for best practices for this, but can’t seem to find one on the boards…

any pointers?

I would think the only character you’d have to escape would be the double-quote character.
Why would you need to escape anything else?

Not sure - line feeds?

The obvious concern is I need to make it error proof.