log4j - ERROR Category option "1." not a decimal integer

created at 12-08-2021 views: 3

error

g4j: Setting property [conversionPattern] to [%d{dd MMM yyyy HH:mm:ss.SSS} [%p] [%t] [%c{1.}] - %m%n].
log4j:ERROR Category option "1." not a decimal integer.
java.lang.NumberFormatException: For input string: "1."
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
………
log4j: Adding appender named [stdout] to category [root].

solution 1

using PatternLayout not EnhancedPatternLayout

%c{1.}

Is only available in EnhancedPatternLayout

check this answer on stackoverflow  

solution 2

There is a problem with the configuration file of log4j.properties:

log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{ 1 }:%L-%m%n

Just remove the spaces before and after 1.

created at:12-08-2021
edited at: 12-08-2021: