Logback.xml is printing only INFO level logs

Here is my application.

package com.spectrum.sci.dsb;  import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan;  @SpringBootApplication @ComponentScan("com.spectrum.sci.dsb") public class DsbApplication {      public static void main(String[] args) {         SpringApplication.run(DsbApplication.class, args);     }  } 

Here is part of my service class.

public ResponseEntity<String> getUCANService(UCANRequest ucanRequest) {         log.info("Entering getUCANService..." + ucanRequest.toString() );                  String ucanId = ucanRequest.getUcanId();         String namespace = ucanRequest.getNamespace();                        String uCanXmlString = applicationPropertyReader.readUCanRequestFile();         ASBMessage asbMessage = DSBUtil.convertXmlStringToASBMessageObj(uCanXmlString);         log.debug("ASBMessage = " + asbMessage.getBody().getAccount().getId().getValue());                     String ucanRequestStr = replaceXmlStringWithUcanOrigData(ucanId, namespace, uCanXmlString);                  return dsbClient.getDSBClient(ucanRequestStr);     } 

Here is my logback.xml

<configuration debug="true">      <logger name="com.spectrum.sci.dsb" level="DEBUG" />     <logger name="httpclient" level="WARN" />     <logger name="org.apache" level="WARN" />     <logger name="org.springframework.context" level="WARN" />      <logger name="org.springframework.core" level="WARN" />     <logger name="org.springframework.beans" level="WARN" />     <logger name="org.springframework.web" level="WARN" />     <logger name="org.springframework.security" level="DEBUG" />          <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">         <file>logs/dsb.log</file>         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">             <fileNamePattern>logs/dsb.%d{yyyy-MM-dd}.%i.log</fileNamePattern>             <maxHistory>10</maxHistory>             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">                 <maxFileSize>5MB</maxFileSize>             </timeBasedFileNamingAndTriggeringPolicy>         </rollingPolicy>         <encoder>             <pattern>[%d{YYYY-MM-dd HH:mm:ss.SSS}] [%level] [Context:%logger{0}] [%X] [%msg]%n</pattern>         </encoder>     </appender>      <root level="info">         <appender-ref ref="FILE" />     </root>      </configuration> 

I have correct package com.spectrum.sci.dsb both in my application and logback.xml.

But, it is printing INFO level logs. If I set VM args using RUN Configuration to DEBUG it prints the DEBUG level message but I don’t want to set in VM args. I would like to put in logback.xml so that prod/dev can be interchangable.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.