Play fails to load custom log back appender

后端 未结 2 547
执念已碎
执念已碎 2021-02-18 21:28

I have created a custom logback appender. But play gives a ClassNotFound exception for the appender.

Following is my appender

package log

import ch.qos.         


        
2条回答
  •  太阳男子
    2021-02-18 21:51

    Although the solution of adding a separate jar file works, I found another solution which adds the benefit of accessing your uri as defined in your application.conf file.

    Create an EagerSingleton in your Module. This will get called during startup. Inside this, construct your MongoDB Appender and add it to the logger you want to log to MongoDB. The benefit is that you can inject your Configuration into this singleton and then access config settings to pass on to your MongoDB Appender.

提交回复
热议问题