Have you tried the Log4j Scala API? http://logging.apache.org/log4j/2.x/manual/scala-api.html
It does currently not support this, but it uses Scala macros, and this could be added there. But log4j-api and/or log4j-core probably needs to adapted as well.
On 2017-12-09 07:30, Jeffrey Shaw wrote:
Hello, I've found that I am able to use Scala macros to provide compile-time source information for log messages. However, I don't see a way to inject this into log4j's logging mechanism. I'm wondering if there is something I'm missing, or if LogEvent's getSource method could be duplicated in Message. We could then have zero-overhead location information in logs. I'm thinking that tools other than Scala could also take advantage of this.
