Missing syntax check output in log file after migrating rules to MainUI

As the title says, I have migrated rules to MainUI. However, when saving the rule it does not write the output of syntax errors into the log file.
Maybe I missed something completely but I cannot find any information about this.

This is how I add a rule:

If the script has errors and I save the script, in the log file I see:

Rule 'GuteNacht' has been updated.

this is the rule yaml code:

configuration: {}
  - id: "1"
      itemName: GuteNacht
      command: ON
    type: core.ItemCommandTrigger
conditions: []
  - inputs: {}
    id: "2"
      type: application/vnd.openhab.dsl.rule
      script: >
        val ruleName = "GuteNacht"

        gRollladen.members.filter(r| (r.state as Number) != 85).forEach [r|r.sendCommand("85")]

        gLampen.members.filter(s| (s.getStateAs(OnOffType)) == ON).forEach [s|s.sendCommand("OFF")]

        if (SamsungTV_Power.getStateAs(OnOffType) == ON) {
          executeCommandLine("python", "/etc/openhab/scripts/samsung.py")
          logInfo(ruleName, "TV wurde ausgeschaltet")

        if (AdbFiretv_SendKeyEvent.getStateAs(OnOffType) == ON) {
          logInfo(ruleName, "FireTV wurde ausgeschaltet")

        //	var firetv = executeCommandLine(Duration.ofSeconds(15), "/usr/bin/bash", "/etc/openhab/scripts/firetv.sh")

        //		logInfo(filename,firetv)

    type: script.ScriptAction

could anybody please confirm or disagree, so that I know if it is my fault or by design?

For me, errors are only displayed in the log when the Ruhle is executed.

Well, that’s a big step backward. Then it does not make any sense to move file based rules into MainUI

I agree with that.
I find it much clearer to work with text files, maybe that’s because I’ve been so used to it since OH1.
It is also clear to me that entry is much easier for newbies via the UI. But if you have a certain number of items you simply lose the overview :nerd_face:

Hi Yannik @ysc,
sorry to bother you. Are there any settings or is there anything we can do so that the syntax is being checked when saving rules in MainUI?

But if you’re using the GUI to enter/edit the rule, wouldn’t you want the error display right there in the GUI where you’re working?

don’t think so, or maybe I am looking at the wrong place

sorry, I should have been clearer - was suggesting what feature you might want rather than actually see today.
If you’re typing and poking ‘save’ on the GUI you wouldn’t want to run off and inspect logs to see if it worked, surely?

I just wanted to point out that something fundamental is missing.
Let me explain what I mean:
As an example, add this faulty line to your working code:

var x = "whatever

When you save your .rules file (note: NOT executing the rule) the log result is the following:

2021-11-20 14:04:33.626 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Test2.rules'
2021-11-20 14:04:33.670 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Test2.rules' has errors, therefore ignoring it: [6,16]: String literal is not properly closed

I can see in the log file what error I have put into my code and where.

When you save the same code in MainUI, then this is the result in your log file:

2021-11-20 14:06:12.163 [INFO ] [openhab.event.RuleUpdatedEvent      ] - Rule 'GuteNacht' has been updated.

No, that’s just how the rules engine works, not the UI. Modules are just declarations that are saved and they are only evaluated when the rule is run. In case of script modules (actions or conditions) this means the script is parsed when the rule is run, not before. You can easily test-run your rule, ignoring triggers and conditions, with the Run Now button (or Ctrl-R). If you have a syntax error it will appear in the log.

If you’re not sure about actually running the code and just want to check the syntax, maybe temporarily inserting a return; statement before any sensible code would work.


I see. Thanks for clarifications.
I tested this and unfortunately you only see an import failure alarm without any further information.
What a pity. I wanted to migrate all my rules to MainUI this weekend :slight_smile:

To me, an OH-hobbyist, I will lose a lot of functionality and comfortability. Whenever I save a rule during creation or changing a rule I immedately look into the log which provides me with important information in which line my error is and what the error is.
Don’t get me wrong - this is not at all complaining. Just sharing my thoughts.