Not without writing a macro and using a logging wrapper everywhere. The "%F" support in Logback uses an exception to check the calling code via the exception's callstack, but due to the async queue that Akka puts between the logging code and Logback, it cannot see the logging location.
In outline, you could do the following: * Define a case class "CallSite" which has filename and line number as params * In the companion object to "CallSite" write an implicit CallSite provider like "implicit def getCallSite: CallSite = macro getCallSiteImpl" * (This implicit will not need to be imported, as it is always in scope when CallSite is in scope) * Write a macro "getCallSiteImpl" which constructs a new CallSite object with the caller's file and line number (use "enclosingOwner") * Write a logging wrapper with method signatures like "def error(cause: Throwable, message: String)(implicit callSite: CallSite): Unit" * add the file and line location to your logs from the "callsite" param in the logging wrapper class I've been meaning to try to push our implementation of this upstream for this use-case and also re some async helper methods like "Future.mapTo" and "akka.pattern.ask" which can have very unhelpful stack traces when they fail, but I don't think I'm going to be able to do it any time soon. Hope this helps, Rich On Wednesday, June 10, 2015 at 1:39:03 PM UTC+1, Leo Barrameda wrote: > > Hi Guys, > > Is there a way to have on the log where the filename + line number where > log.debug/info is called: right now I enabled it on my config using %F but > upon checking it logs always log as origin of the logs to the Slf4jLogger > class? > > Thanks, > > - Leo B > -- >>>>>>>>>> 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.
