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

log4j:ERROR Category option " 1 " not a decimal integer.
java.lang.NumberFormatException: For input string: " 1 "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at org.apache.log4j.helpers.PatternParser.extractPrecisionOption(PatternParser.java:117)
at org.apache.log4j.helpers.PatternParser.finalizeConverter(PatternParser.java:235)
at org.apache.log4j.helpers.PatternParser.parse(PatternParser.java:187)
at org.apache.log4j.PatternLayout.setConversionPattern(PatternLayout.java:446)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:206)
at org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:165)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:130)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:684)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:544)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:440)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
at org.apache.log4j.Logger.getLogger(Logger.java:105)

at com.server.STest.<clinit>(STest.java:7)

 

 

解决方案:

log4j.properties 的配置文件有问题

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

去除 1 前后的空格即可

posted on 2012-05-26 23:19  ycty  阅读(2113)  评论(0编辑  收藏  举报