Hi together,
*Overview:*
I want to combine the FSM trait with DiagnosticActorLogging. This leads to
compile time errors. I was able to resolve the error by overriding the log
value,
however I don't like the solution...
Maybe one of you has a better idea !
*Details:*
Consider the following snippet:
class MyFsmForTest extends FSM[State, Params] with DiagnosticActorLogging {
If you try to compile it the following error will be thrown:
class MyFsmForTest inherits conflicting members:
method log in trait ActorLogging of type => akka.event.LoggingAdapter
and
value log in trait DiagnosticActorLogging of type
akka.event.DiagnosticLoggingAdapter
(Note: this can be resolved by declaring an override in class
MyFsmForTest.)
It can be resolved by overriding the log value like this
trait FSMActorLogging[S, D] extends DiagnosticActorLogging {
this: FSM[S, D] =>
// override def log from FSM -> ActorLogging
// and val log from DiagnosticActorLogging
// Problem: unstable during initialization + double init overhead (for both
vals)
override val log = akka.event.Logging(this)
}
But (according to some experiments) the value initialization
(akka.event.Logging(this)) is executed twice, once for the
DiagnosticActorLogging trait and once in the FSMActorLogging trait.
Additionally during initialization the log value changes and is
"empty/null" for some time.
The alternative override val log = super[DiagnosticActorLogging].log
does not work anymore (according to some blog posts did work for older
Scala versions)
I think the route problem is that DiagnosticActorLogging defines log as a
value but I don't see how I could change that (-;
Any ideas how to better solve this issue? Any suggestions are welcome
best regards Michael
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.