Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the name of the Item in warning logs from ItemStateConditionHandler #2450

Closed
rkoshak opened this issue Aug 4, 2021 · 3 comments · Fixed by #2540
Closed

Include the name of the Item in warning logs from ItemStateConditionHandler #2450

rkoshak opened this issue Aug 4, 2021 · 3 comments · Fixed by #2540
Labels
automation enhancement An enhancement or new feature of the Core PR pending

Comments

@rkoshak
Copy link

rkoshak commented Aug 4, 2021

I just spent a little bit of time hunting down the cause of a warning from org.openhab.core.automation.internal.module.handler.ItemStateConditionHandler and I'm sure I'm not the only one. The log in my case was:

Received a QuantityType state '75 %' with unit, but the condition is defined as a plain number without unit (50), please consider adding a unit to the condition.

Line 112 in the .java file.

That's really a great log message except it's missing the one key piece of information I as the user need: the name of the Item.

There are other log statements in this file that could benefit from the inclusion of the Item name as well.

  • Line 120
  • Line 138
  • Line 146
  • Line 163
  • Line 171
  • Line 189
  • Line 197

I'd make the changes myself but I don't have a build environment and it'd take me a bit to set one up. I'm hesitant to blindly submit even such a simple change as this without being able to build and test.

Thanks!

@J-N-K
Copy link
Member

J-N-K commented Aug 4, 2021

IMO it would be better to log the ruleUID of the rule that this condition belongs to.

@rkoshak
Copy link
Author

rkoshak commented Aug 4, 2021

From looking at the code I don't see that the rule ID is currently available in that class. But the Item name is definitely available. If getting both is possible that would be the best.

@cweitkamp
Copy link
Contributor

I submitted #2540 to improve the logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation enhancement An enhancement or new feature of the Core PR pending
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants