Did you look at the scaladoc of LogSource like the exception told you to?

It contains an explanation of to provide a log source for any kind of type.

system.log will work fine as well though, as long as you don't want a
specific log source in your log entries logged from the test.
--
Johan
Akka Team

On Mon, Aug 8, 2016 at 12:00 AM, Maatary Okouya <maatarioko...@gmail.com>
wrote:

> Hi,
>
>
> I have been trying to Log things within my scalaTest as such:
>
> class ChangeSetActorTest extends 
> PersistenceSpec(ActorSystem("Persistent-test-System")) with 
> PersistenceCleanup {
>
>
>   val log = Logging(system, this)
>
>
>
> Basically let's just say that ChansetActorTest inherit from TestKit(system)
>
>
> Unfortunately Logging(system, this) does not work with the* this*
>
> I get the following error:
>
> [error] /Users/maatary/Dev/IdeaProjects/PoolpartyConnector/src/test/
> scala/org/iadb/poolpartyconnector/changepropagation/ChangeSetActorTest.scala:22:
> Cannot find LogSource for org.iadb.poolpartyconnector.ch
> angepropagation.ChangeSetActorTest please see ScalaDoc for LogSource for
> how to obtain or construct one.
> [error]   val log = Logging(system, this)
>
>
> I beleive in the Akka Logging Doc this is the following point:
>
>    - and in all other cases a compile error occurs unless and implicit
>    LogSource[T] is in scope for the type in question.
>
>
> In other words there is no LogSource[TestKit]
>
>
>
> I would like the simplest solution to deal with that issue, with minimal
> additional configuration. So far what i did is the following and everything
> works as expected:
>
> class ChangeSetActorTest extends 
> PersistenceSpec(ActorSystem("Persistent-test-System")) with 
> PersistenceCleanup {
>
>
>   val log = system.log
>
>
>
> From there I just go and do things like
>
> val received = chgtFetcher.receiveWhile((requestInterval + 
> ProcessingLag).*(3)) {
>   case msg:FetchNewChangeSet => log.info(s"received: ${msg}" ) ; 
> chgtFetcher.reply(NoAvailableChangeSet); msg
> }
>
>
>
> My question, is this recommended appraoch. So far the order of the message
> coming from my actor and the one from the test are well ordered.
>
>
> Please cloud you let me know the recommended appraoch to log in a unified
> appraoch:
>
> 1 - From the Test class (e.g. above) and the Actor at the same time ?
>
> 2 - If one uses a system where external class needs to log as well and we
> need one unified logging (asynchronous) going on.
>
>
> Many thanks
>
> -M-
>
>
>
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to