%c{1.} 是哪个版本的 log4j 生效的

What version of log4j did %c{1.} become valid

我想使用以下转换模式

%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{1.}:%L - %m%n

产生类似

的输出
2016-06-08 10:29:40 [http-nio-8080-exec-8] DEBUG h.d.h.l.l.s.w.f.MyClass:27 - This is a debug message.
2016-06-08 10:29:40 [http-nio-8080-exec-8] INFO  h.d.h.l.l.s.w.f.MyClass:22 - This is an info message.
2016-06-08 10:29:40 [http-nio-8080-exec-8] WARN  h.d.h.l.l.s.w.f.MyClass:33 - This is a warn message.
2016-06-08 10:29:40 [http-nio-8080-exec-8] ERROR h.d.h.l.l.s.w.f.MyClass:39 - This is an error message.
2016-06-08 10:29:40 [http-nio-8080-exec-8] FATAL h.d.h.l.l.s.w.f.MyClass:45 - This is a fatal message.

然而,当我 运行 我的测试并触发我的 log4j 文件时,我收到错误消息

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

我的 pom 中设置了 Log4j 和 slf4j

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.19</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.19</version>
  <scope>runtime</scope>
</dependency>

我需要什么版本的 log4j 1. 才能成为有效的类别选项。

我使用的是 PatternLayout 而不是 EnhancedPatternLayout

%c{1.}

仅在 EnhancedPatternLayout 中可用