mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
move event logging for better analyze options (#856)
* move event logging for better analyze options * add another optional event handling logging Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit is contained in:
parent
1f20e8277a
commit
9018e9ae80
@ -56,8 +56,6 @@ public class EventHandler {
|
||||
}
|
||||
|
||||
public void handleEvent(org.osgi.service.event.Event osgiEvent) {
|
||||
logger.trace("Handle OSGi event (event: {})", osgiEvent);
|
||||
|
||||
Object typeObj = osgiEvent.getProperty("type");
|
||||
Object payloadObj = osgiEvent.getProperty("payload");
|
||||
Object topicObj = osgiEvent.getProperty("topic");
|
||||
@ -132,6 +130,7 @@ public class EventHandler {
|
||||
for (final EventSubscriber eventSubscriber : eventSubscribers) {
|
||||
EventFilter filter = eventSubscriber.getEventFilter();
|
||||
if (filter == null || filter.apply(event)) {
|
||||
logger.trace("Delegate event to subscriber ({}).", eventSubscriber.getClass());
|
||||
safeCaller.create(eventSubscriber, EventSubscriber.class).withAsync().onTimeout(() -> {
|
||||
logger.warn("Dispatching event to subscriber '{}' takes more than {}ms.",
|
||||
eventSubscriber.toString(), SafeCaller.DEFAULT_TIMEOUT);
|
||||
@ -139,6 +138,8 @@ public class EventHandler {
|
||||
logger.error("Dispatching/filtering event for subscriber '{}' failed: {}",
|
||||
EventSubscriber.class.getName(), e.getMessage(), e);
|
||||
}).build().receive(event);
|
||||
} else {
|
||||
logger.trace("Skip event subscriber ({}) because of its filter.", eventSubscriber.getClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ public class ThreadedEventHandler implements Closeable {
|
||||
final EventHandler worker = new EventHandler(typedEventSubscribers, typedEventFactories, safeCaller);
|
||||
while (running.get()) {
|
||||
try {
|
||||
logger.trace("wait for event");
|
||||
final Event event = queue.poll(1, TimeUnit.HOURS);
|
||||
logger.trace("inspect event: {}", event);
|
||||
if (event == null) {
|
||||
logger.debug("Hey, you have really very few events.");
|
||||
} else if (event == notifyEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user