Sorry Will if I wasn't clear before. What I meant was, I was able to get log4j2 working but the AsyncLogger is not working.
This application configures custom logging with Log4j2 AsyncLogger.
Run it using activator -Dlog4j.configurationFile=conf/log4j2.xml
Log4j2.xml is configured to use two loggers, root and an AsyncLogger. It will also created two log files sync.log and async.log
All the log stmts those use AsyncLogger should go inside async.log
When I run this application, I ran into below stack trace:
--------------------------------------------------------------------------------------------------------------------
No play.logger.configurator found: logging must be configured entirely by the application.
--- (Running the application, auto-reloading is enabled) ---
2016-04-05 11:35:13,797 pool-4-thread-2 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.async.AsyncLoggerConfig for element AsyncLogger.
2016-04-05 11:35:13,800 pool-4-thread-2 ERROR Null object returned for AsyncLogger in Loggers.
INFO | 2016-04-05 11:35:14 | [pool-4-thread-2] play.api.LoggerLike$class (Logger.scala:92) - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
Server started, use Cmd+P to stop
DEBUG | 2016-04-05 11:35:15 | [ForkJoinPool-1-worker-1] play.api.LoggerLike$class (Logger.scala:73) - Starting application default Akka system: application
INFO | 2016-04-05 11:35:15 | [ForkJoinPool-1-worker-1] play.api.LoggerLike$class (Logger.scala:92) - Application started (Dev)
--------------------------------------------------------------------------------------------------------------------
As I am using AsyncLogger, my debug logs should be going to async.log. But it's writing it to sync.log ( reason looks obvious from the stack trace above ERROR Null object returned for AsyncLogger in Loggers). I also verified this log4j configuration works just fine in a simple java application.
Appreciate your assistance!
-Mukul