You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2021/12/16 11:25:51 UTC

[plc4x] branch develop updated: fix: fixed the worker log.

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new e1c73a7  fix: fixed the worker log.
e1c73a7 is described below

commit e1c73a763049258d240456672854116d3fb4c879
Author: cdutz <ch...@c-ware.de>
AuthorDate: Thu Dec 16 12:11:51 2021 +0100

    fix: fixed the worker log.
---
 plc4go/internal/plc4go/spi/default/DefaultCodec.go | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/plc4go/internal/plc4go/spi/default/DefaultCodec.go b/plc4go/internal/plc4go/spi/default/DefaultCodec.go
index 4d3b7cf..ef6133d 100644
--- a/plc4go/internal/plc4go/spi/default/DefaultCodec.go
+++ b/plc4go/internal/plc4go/spi/default/DefaultCodec.go
@@ -230,19 +230,20 @@ func (m *defaultCodec) HandleMessages(message interface{}) bool {
 }
 
 func (m *defaultCodec) Work(codec *DefaultCodecRequirements) {
-	defer func() {
+	workerLog := log.With().Logger()
+	if !config.TraceDefaultMessageCodecWorker {
+		workerLog = zerolog.Nop()
+	}
+
+	defer func(workerLog zerolog.Logger) {
 		if err := recover(); err != nil {
 			// TODO: If this is an error, cast it to an error and log it with "Err(err)"
 			log.Error().Msgf("recovered from: %#v at %s", err, string(debug.Stack()))
 		}
-		log.Trace().Msg("Keep running")
+		workerLog.Warn().Msg("Keep running")
 		m.Work(codec)
-	}()
+	}(workerLog)
 
-	workerLog := log.With().Logger()
-	if !config.TraceDefaultMessageCodecWorker {
-		workerLog = zerolog.Nop()
-	}
 	// Start an endless loop
 mainLoop:
 	for m.running {