You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "TjarkoG (via GitHub)" <gi...@apache.org> on 2024/10/21 11:09:19 UTC

[I] LoggingAdapter with ActorSystem and class broken in scala3 [pekko]

TjarkoG opened a new issue, #1538:
URL: https://github.com/apache/pekko/issues/1538

   when migrating from scala `2.13.14` to scala `3.3.0` we're running into an error with the LoggingAdapter. 
   The setup:
   ```scala
   package com.example
   
   import org.apache.pekko.actor.ActorSystem
   import org.apache.pekko.event.{Logging, LogSource, LoggingAdapter}
   
   
   class Foo(actorSystem: ActorSystem) {
     val bar: LoggingAdapter = Logging(actorSystem, getClass)
   }
   ```
   does compile with scala `2.13.14` but with scala `3.3.0` it runs into the following Error:
   ```
   Cannot find LogSource for Class[? <: com.example.Foo] please see ScalaDoc for LogSource for how to obtain or construct one..
   I found:
   
       org.apache.pekko.event.LogSource.fromAnyClass[T]
   
   But method fromAnyClass in object LogSource does not match type org.apache.pekko.event.LogSource[Class[? <: com.example.Foo]].
     val bar: LoggingAdapter = Logging(actorSystem, getClass)
    ```
    
    pekko version used is `1.1.2`
    
    if this is not a bug and only an error on my side im sorry but i have not found anything on this topic in the docs
    


-- 
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: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "raboof (via GitHub)" <gi...@apache.org>.
raboof commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426443000

   > should we add something bout this in the scaladoc for org. apache. pekko. event.Logging or org. apache. pekko. event.LoggingSource 
   
   I think it'd make sense to keep this issue open until we've improved the docs to make this more clear, indeed


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426378906

   Scala 3 is the issue here. It doesn't accept 100% of Scala 2 code.
   
   I usually just change `getClass` to `classOf[MyClass]` where MyClass is the name of the class.
   
   I think you can get `Logging(actorSystem, getClass)` to work by providing the implicit converter explicity. I haven't tried the exact solution but it is something like.
   
   `Logging(actorSystem, getClass)(org.apache.pekko.event.LogSource.fromAnyClass)`
   
   That `Logging` constructor takes a 2nd param list where the params are implicits but somehow Scala 3 doesn't find the implied value.
    


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "TjarkoG (via GitHub)" <gi...@apache.org>.
TjarkoG commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426424807

   oh yes it does.
   thank you. very much and sorry for opening an issue. should we add something bout this in the scaladoc for org. apache. pekko. event.Logging or org. apache. pekko. event.LoggingSource to avoid additional issues about this being created?


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "TjarkoG (via GitHub)" <gi...@apache.org>.
TjarkoG commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426394834

   yes the classOf[Foo] solution was something we've thought of the problem ist that in the actual code we don't have the class yet. In the actual code Foo is a trait and we don't have the implementing class yet
   but if this will be to complicated we'll just do it in the implementing classes
   


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #1538: LoggingAdapter with ActorSystem and class broken in scala 3
URL: https://github.com/apache/pekko/issues/1538


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426410112

   I found a comment on an issue suggesting that `Logging(actorSystem, getClass)(org.apache.pekko.event.LogSource.fromClass)` may work.


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LoggingAdapter with ActorSystem and class broken in scala 3 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1538:
URL: https://github.com/apache/pekko/issues/1538#issuecomment-2426392049

   Similar issue - https://github.com/akka/akka-grpc/issues/1396


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org