mbeckerle commented on code in PR #781:
URL: https://github.com/apache/daffodil/pull/781#discussion_r879758309
##########
daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLAppender.scala:
##########
@@ -38,25 +38,32 @@ class TDMLAppender
import TDMLAppender._
override def append(event: LogEvent): Unit = {
- diagnostics = new LogDiagnostic(event.getMessage.getFormattedMessage)
+: diagnostics
+ checkForKey
+ diagnostics = diagnostics.updated(Thread.currentThread.getId,
diagnostics(Thread.currentThread.getId) :+ new
LogDiagnostic(event.getMessage.getFormattedMessage))
}
}
object TDMLAppender{
- var diagnostics: Seq[Diagnostic] = Nil
- var diagnostics2: Seq[String] = Nil
+ var diagnostics: Map[Long, Seq[Diagnostic]] = Map()
Review Comment:
Sure, but that doesn't change the fact that a singleton object has mutable
state in it. I think this appender needs to be an allocated object, not a
singleton.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]