Hello Shimrit,

Do you have a particular reason for using log4j rather than slf4j?

Are you using https://github.com/hseeberger/akka-log4j ? If so, it looks
like this (like the standard slf4j logger) exposes the 'akkaSource' value
as an MDC context parameter. This contains the address of the actor.

The rest is then a matter of log4j configuration, I'm afraid I'm not
familiar enough with slf4j to help there.

Does that help?


Kind regards,

Arnout


Kind regards,

Arnout

On Thu, Apr 6, 2017 at 1:31 PM, Shimrit Hoori <shimritho...@gmail.com>
wrote:

> I'm currently using log4j property `RollingFileAppender` to redirect the
> logs to a file, and the log file name is defined by a process argument:
>
> log4j.properties:
>
> log4j.appender.file=org.apache.log4j.RollingFileAppender
> log4j.appender.file.File=-${filename}
>
>
> Calling the process with args:
>  -Dfilename=childActor1
>
>
> The actor is defined as:
> class MyActor extends Actor with ActorLogging
>
>
> This works fine for remote actors, but now I want to create local child
> actors and redirect the log file to a file with the name of the actor.
> I've read I can use `RoutingAppender` to switch logs between threads, but
> I'm not sure how is that integrated with Akka.
>
> I feel like there should be some kind of simple solution to do that but I
> can't find it, and the Akka documentation for logging is really poor.
>
> --
> >>>>>>>>>> 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.
>



-- 
Arnout Engelen
*Senior Software Engineer*
E: arnout.enge...@lightbend.com
T: https://twitter.com/raboofje

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