Hi Nils,
I actually would keep logging separated as you have now, and simply use
slf4j as provider for both so it will be one config file (
http://doc.akka.io/docs/akka/snapshot/java/logging.html#slf4j ).
In your non actor classes you'd use the scala-logging
<https://github.com/typesafehub/scala-logging> which is strict and in
actors the akka provided
<http://doc.akka.io/docs/akka/current/java/logging.html> adapter which is
async, both use slf4j so configs won't have to be duplicated.

On Fri, Oct 17, 2014 at 9:24 AM, <[email protected]> wrote:

> Hi!
>
> I'm using Akka with Java, and I'm trying to figure out the best way to
> "share" logging between actors and regular classes that also do logging.
> We're using slf4j both with our actors and other classes, so we already
> have everything with the same pattern and in the same logfile. From what
> I've learned, Akka does asynchronous logging, and using the slf4j API
> directly in our other classes performs logging synchronously. I guess if we
> want to be consistent, we should do all logging async, and hence we should
> use the Akka logging everywhere. So I'm wondering if there are any
> guidelines/best practices how to achieve this? I have been thinking of a
> few approaches:
>
> - Change all our classes to take the ActorSystem/EventBus as a parameter.
> Use this to construct the LoggingAdapter. However, this is quite intrusive,
> and also introduces a dependency to akka from classes that might be shared
> with other non-akka modules.
> - Create a facade on top of Akka/slf4j. Would solve the above problem, but
> also seems like a lot of extra work, considering slf4j already is a facade.
> - Just ignore it all and don't care if we have both async and sync logging.
>
> I'm interested to learn how other people on this list solve this issue.
>
> Regards,
>
> Nils-Helge Garli Hegvik
>
> --
> >>>>>>>>>> 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.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe

<http://typesafe.com>

-- 
>>>>>>>>>>      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.

Reply via email to