gpt4 book ai didi

来自 log4j 的 java.lang.IllegalArgumentException

转载 作者:行者123 更新时间:2023-11-30 08:12:28 25 4
gpt4 key购买 nike

我的客户遇到问题,他已向我发送日志文件。
日志文件包含一些崩溃,如下所示。

log4j:WARN Failed to set property [maxFileSize] to value "10MB". 
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...

log4j:WARN Failed to set property [file] to value "../logging/serviceContainer2100.log".
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...

log4j:WARN Failed to set property [maxBackupIndex] to value "10 ".
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...

随附 log4J 配置文件:

# Set root logger level and appenders.
log4j.rootLogger=info, A1, R

# Appender A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# Layout for A1
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

# Appender R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log/DependencyAnalyzer.log
log4j.appender.R.MaxFileSize=1000KB
log4j.appender.R.MaxBackupIndex=10

# Layout for R
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

我尝试用谷歌搜索这个问题,但没有得到任何满意的答复。
谁能建议在哪里进一步深入研究这个问题或者可能的原因是什么?

最佳答案

文件属性值似乎有错误../logging/serviceContainer2100.log比较您的配置文件中的值,请尝试一下 log4j.properties配置文件,可能会给您一些帮助,我只是对文件路径和一些附加程序进行了一些更改以进行测试,但它对我有用,等待您的反馈

# Root logger option
log4j.rootLogger=DEBUG,A1 , A, R


# Appender A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# Layout for A1
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n


# Redirect log messages to console
log4j.appender.A=org.apache.log4j.ConsoleAppender
log4j.appender.A.Target=System.out
log4j.appender.A.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.A.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n


# Redirect log messages to a log file, support file rolling.
#log4j.appender.file=org.apache.log4j.RollingFileAppender
#log4j.appender.file.File=file.log
#log4j.appender.file.MaxFileSize=5MB
#log4j.appender.file.MaxBackupIndex=10
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n


# Appender R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=trace.log
log4j.appender.R.MaxFileSize=1000KB
log4j.appender.R.MaxBackupIndex=10

# Layout for R
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

关于来自 log4j 的 java.lang.IllegalArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30187057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com