I get the following error with the logback-spring.xml. %C is for class, not sure about {1.} after it.
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.classic.pattern.ClassOfCallerConverter@436e641b - failed to parse integer string [1.] java.lang.NumberFormatException: For input string: "1."
Config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOGS" value="./logs" />
<appender name="Console"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>
<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="Console" />
</root>
</configuration>
According to the official documentation the conversion C takes an integer as an option. So just remove the dot . after the number %C{1.} and it will work fine.
As stated in logback PatternLayout manual, %C is the conversion word for the fully-qualified class name of the caller issuing the logging request. This conversion takes an integer as an option to shorten the class name. You should remove dot from %C{1.} as the compiler clearly states that it's parsing the option as an integer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With