# Rules execution speed

**URL:** <https://community.openhab.org/t/rules-execution-speed/15202>\
**Category:** Beginners\
**Created:** [October 13, 2016, 4:11am UTC](https://community.openhab.org/t/rules-execution-speed/15202 "2016-10-13T04:11:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdhiraj](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@gdhiraj](https://community.openhab.org/u/gdhiraj)\
**Post date:** [October 13, 2016, 4:11am UTC](https://community.openhab.org/t/rules-execution-speed/15202/1 "2016-10-13T04:11:03Z")

</div>

Hello,

I am executing multiple commands via single rule (like a mood or scene activation) but there is a lot of delay in this execution from pressing a button on IOS app the execution of rule and commands inside happens after 3-4 seconds this makes the user feels that nothing happened by pressing button and tend to press it again. Any pointers to improve this ?

I run system on Pi3 and “top” shows me Java taking up close to 100% of cpu most of time.  
rule “LR\_AllOff\_Fast”.. i have mix of Items from Hue to Zwave to lightwaverf in single rule as below -

//SITEMAP  
Switch Item=LRAllOff mappings=[On=“All Off”]

//ITEMS  
String LRAllOff “Living Room All Off”

//RULES  
when  
Item LRAllOff changed to ON or  
Item LRBrightMood changed to OFF

then  
sendCommand(PoppDimmer1LoadLevelStatus, 0)  
sendCommand(PoppDimmer2LoadLevelStatus, 0)  
sendCommand(LRDimmerBulb02\_03, 0)  
sendCommand(LRCornerLamp01, OFF)  
sendCommand(LRCornerLamp02, OFF)  
sendCommand(LRTallCabinetLight, OFF)  
sendCommand(LRDiningAntiqueLight, OFF)  
sendCommand(LRBookRackLight, OFF)

end

---

<div class="post-metadata">

**Author:** ![mstormi](https://community.openhab.org/user_avatar/community.openhab.org/mstormi/32/55857_2.png) [@mstormi](https://community.openhab.org/u/mstormi)\
**Post date:** [October 13, 2016, 7:32am UTC](https://community.openhab.org/t/rules-execution-speed/15202/2 "2016-10-13T07:32:01Z")

</div>

Mmh. A RPi3 is way fast enough and OH should need far less CPU.  
Check logging, in particular increase it for rules.  
` <logger name="org.openhab.model.script.rules" level="DEBUG" />`

Reinitializations use 100% CPU They’re taking place after you change items, rules or sitemaps.  
While this is normally accomplished in less than seconds, if a rule fails to load or crashes during execution, this can become a repetitive process, resulting in permanent CPU load you’re seeing.

---

<div class="post-metadata">

**Author:** ![gdhiraj](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@gdhiraj](https://community.openhab.org/u/gdhiraj)\
**Post date:** [October 13, 2016, 11:44am UTC](https://community.openhab.org/t/rules-execution-speed/15202/3 "2016-10-13T11:44:10Z")

</div>

Thanks for the pointer .. however i am using OH2 and i cannot figure out where to put the logging statement for “rules” as there is no logbook.xml in OH2 .. can you suggest further.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 13, 2016, 8:27pm UTC](https://community.openhab.org/t/rules-execution-speed/15202/4 "2016-10-13T20:27:44Z")

</div>

> [@Taming openHAB 2 Logging](https://community.openhab.org/t/taming-openhab-2-logging/13976):
>
> This post is OBE. See [Log4j2 Sample Config](https://community.openhab.org/t/log4j2-sample-config/33284) \*\*NOTE: With the build from November 10 #579 the location of all the files in runtime/karaf/etc have moved to userdata/etc. The instructions below have been updated accordingly. If you are running an older verison of openHAB (anything older than build #579), the location of the file is runtime/karaf/etc. As almost everyone is aware, openHAB 2 uses a completely different logging library and approach to logging than openHAB 1.x does, replacing logback wi…

---

<div class="post-metadata">

**Author:** ![gdhiraj](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@gdhiraj](https://community.openhab.org/u/gdhiraj)\
**Post date:** [October 14, 2016, 3:10am UTC](https://community.openhab.org/t/rules-execution-speed/15202/5 "2016-10-14T03:10:38Z")

</div>

hi Rich,

thanks i tried this - with the following updated to my logging file  
the rules.log file is generated by no entries are wrttend in it .. ☹ .. any help.

# openHAB specific logger configuration

log4j.logger.org.openhab.model.script.rules = ALL, rules, osgi:\*  
log4j.additivity.org.openhab.model.script.rules = false

# File appender - rules.log

log4j.appender.rules=org.apache.log4j.RollingFileAppender  
log4j.appender.rules.layout=org.apache.log4j.PatternLayout  
log4j.appender.rules.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n  
log4j.appender.rules.file=${openhab.logdir}/rules.log  
log4j.appender.rules.append=true  
log4j.appender.rules.maxFileSize=5MB  
log4j.appender.rules.maxBackupIndex=5

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 14, 2016, 3:37am UTC](https://community.openhab.org/t/rules-execution-speed/15202/6 "2016-10-14T03:37:17Z")

</div>

You should use

```
log4j.logger.org.eclipse.smarthome.model.script = ALL, rules, osgi: *

```

All of the core classes have changed packages in OH 2.

---

<div class="post-metadata">

**Author:** ![gdhiraj](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@gdhiraj](https://community.openhab.org/u/gdhiraj)\
**Post date:** [October 14, 2016, 5:31am UTC](https://community.openhab.org/t/rules-execution-speed/15202/7 "2016-10-14T05:31:43Z")

</div>

I tried

# openHAB specific logger configuration

log4j.logger.org.eclipse.smarthome.model.script = ALL, rules, osgi: \*  
log4j.additivity.org.eclipse.smarthome.model.script = false

also i tried

# openHAB specific logger configuration

log4j.logger.org.eclipse.smarthome.model.script.rules = ALL, rules, osgi: \*  
log4j.additivity.org.eclipse.smarthome.model.script.rules = false

but both doesnt generate any logs from rules 😕

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 14, 2016, 8:59pm UTC](https://community.openhab.org/t/rules-execution-speed/15202/8 "2016-10-14T20:59:36Z")

</div>

Not sure what is wrong. The sum total of my knowledge on the subject is captured by the link I provided.
