当我运行我的应用程序时,得到的文件名为空Log4j -得到的文件名为空{参数为空:文件名} LOg4j2.yaml:-〉
Configuration:
status: debug
packages: com.xyz.x.log
appenders:
Console:
name: LogToConsole
PatternLayout:
#Pattern: "%reqId%msg%n"
Pattern: "%d{YYYY-MM-DD HH:mm:ss.SSS} [%-5level] %C{1} %L - %m%n"
File:
name: LogToFile
PatternLayout:
Pattern: "%d{YYYY-MM-DD HH:mm:ss.SSS} [%-5level] %C{1} %L - %m%n"
Loggers:
logger:
- name: com.xyz.x
level: debug
additivity: false
AppenderRef:
- ref: LogToConsole
- ref: LogToFile
- name: org.springframework.security
level: debug
additivity: false
AppenderRef:
- ref: LogToConsole
- ref: LogToFile
Root:
level: error
AppenderRef:
ref: LogToConsole
我遇到的错误:
File org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element File are invalid: field 'fileName' has invalid value 'null'
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:208)
1条答案
按热度按时间roejwanj1#
修改
File
附加器以添加 filename 属性例如: