7

How to write logback.xml for Micronaut, like Spring Boot: https://www.logicbig.com/tutorials/spring-framework/spring-boot/profile-logback-logging-config.html

I think springProfile doesn't exist in Micronaut. I have Micronaut environments and I want to use these for example change logging format only per Micronaut environment.

Best regards Imre

Krabi
  • 113
  • 1
  • 9

1 Answers1

-7

https://github.com/micronaut-projects/micronaut-examples/blob/master/websocket-chat/src/main/resources/logback.xml

Recently, I ported my spring boot application to Micronaut and used the same logback.xml as given above. Hope this helps.

nehacharya
  • 925
  • 1
  • 11
  • 31
  • Hi. I got similar solution. But I don't see there what I'm looking for. I'm trying to point to section in the link, I added: ... With tag property "name" I can bind section to spring profile (usually used for environment separation). In Micronaut we have environment's. So how can I bind section of configuration to Micronaut environments? – Krabi Jul 28 '19 at 11:43
  • 1
    So I have a gradle micronaut project and there's a build.gradle file which has the below configuration to run the dev profile: `configurations { // for dependencies that are needed for development only developmentOnly }` `run.classpath += configurations.developmentOnly` `run.jvmArgs('-Dmicronaut.environments=dev','-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')` – nehacharya Jul 28 '19 at 13:25
  • I can say, that environments are working in my Micronaut project perfectly. I can choose with build tool (for may case maven) Micronaut environment. Problem is how can one **Micronaut environment** have section in logback? From suggestion I don't see that logback does something different with dev environment. – Krabi Jul 28 '19 at 15:04
  • 1
    The provided answer doesnt show an example on how to use micronaut environments as profiles. I believe the OP is trying to do something like this using micronaut ` some-host some-host ` – patelb May 18 '20 at 18:25
  • @salazarin Is there any other way to do the operation without changing anything in build.gradle?. Can we achieve the same by doing some changes in IntelliJ IDE – vishal.kangralkar Jul 14 '20 at 13:19