Micronaut: Loggers in certain packages are not appearing in AWS lambda and in local

Viewed 404

The Micronaut version I am using is 1.3.4 and gradle dependency for logging is runtimeOnly "ch.qos.logback:logback-classic:1.3.0-alpha5".

I have specified the packages and their log levels in logback.xml. I am facing the following issues with loggers:

  • It only works when all packages specified in the project structure have the word service in them. So, the below configuration works perfectly.

    <configuration>
       <appender name="STDOUT"
          class="ch.qos.logback.core.ConsoleAppender">
          <!-- encoders are assigned the type 
          ch.qos.logback.classic.encoder.PatternLayoutEncoder 
          by default -->
        <encoder>
         <pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread])
             %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern>
        </encoder>
     </appender>
       <logger name="io.micronaut.https.client" level="TRACE"/>
       <root level="info">
           <appender-ref ref="STDOUT" />
       </root>
       <logger name="com.abc.eng.service.api" level="info">
           <appender-ref ref="STDOUT" />
       </logger>
       <logger name="com.abc.eng.service" level="info">
           <appender-ref ref="STDOUT" />
       </logger> 
    </configuration>
    
  • However, if there are packages excluding service from their name, none of the loggers from any of the packages show up in my local or in CloudWatch logs. i.e.,

    <configuration>
       <appender>
             ......
       </appender>
       <logger name="io.micronaut.https.client" level="TRACE"/>
       <root level="info">
         <appender-ref ref="STDOUT" />
       </root>
       <logger name="com.abc.eng" level="info">
         <appender-ref ref="STDOUT" />
       </logger>
       <logger name="com.abc.eng.service.api" level="info">
         <appender-ref ref="STDOUT" />
       </logger>
       <logger name="com.abc.eng.service" level="info">
         <appender-ref ref="STDOUT" />
       </logger>  
    </configuration>
    

As package com.abc.eng doesn't have service as a part of the package name, none of the loggers appear from any of the packages specified (not even loggers from the service named packages like com.abc.eng.service.api or com.abc.eng.service).

Is this a version issue since loggers in microservices with older Micronaut versions - 1.1.1 work perfectly? Please let me know. Thanks!

0 Answers
Related