问题
I would like to configure logging appender based on the environment, for example while running in production I would like to configure an appender that would send log to elasticsearch but while on test or development mode this appender would not be enabled.
回答1:
To put the correct answer here from the above comment. According to this link, you can just add a logback-production.xml
, where production
is the name of your profile.
回答2:
As far I understand, Micronaut doesn't have similar thing like Spring boot ( ) implemented. I think logback-production.xml (where production is profile ) doesn't work too - only logback.xml and logback-test.xml is suported.
来源:https://stackoverflow.com/questions/57135912/micronaut-configure-logger-appenders-based-of-the-enviroment