Thanks david. I moved folder META-INF/log4j.properties to WEB-INF/classes/, and then modify deployment plan with : <dep:attribute name="log4jResource">META-INF/log4j.properties</dep:attribute>
It works oz it's in the classpath now. viola.lu wrote: > > hi, i follow steps in > http://cwiki.apache.org/GMOxDOC22/configuring-application-specific-logging-with-log4j.html, > and add gbean information in geronimo-web.xml using log4jResource. > > <dep:gbean > class="org.apache.geronimo.system.logging.log4j.ApplicationLog4jConfigurationGBean" > name="testlogLog4jConfiguration"> > > <dep:attribute > name="log4jResource">META-INF/log4j.properties</dep:attribute> > > </dep:gbean> > > But "Can't find META-INF/log4j.properties " error always exists. if i use > log4jFile setting like below: > > <dep:gbean > class="org.apache.geronimo.system.logging.log4j.ApplicationLog4jConfigurationGBean" > name="testlogLog4jConfiguration"> > <dep:attribute > name="log4jFile">var/log/log4j.properties</dep:attribute> > <dep:reference > name="ServerInfo"><dep:name>ServerInfo</dep:name></dep:reference> > <!--<dep:attribute > name="log4jResource">META-INF/log4j.properties</dep:attribute>--> > </dep:gbean> > > it works well. > > I looked into ApplicationLog4jConfigurationGBean code: > ... > InputStream in; > if (log4jFile != null) { > File file = serverInfo.resolveServer(log4jFile); > in = new FileInputStream(file); > } else if (log4jResource != null) { > in = classloader.getResourceAsStream(log4jResource); > if (in == null) { > throw new NullPointerException("No log4j properties > resource found at " + log4jResource); > } > } else { > return; > } > > ... > > in = classloader.getResourceAsStream(log4jResource); > > ClassLoader will search this file from classpath, and my project structure > is: > > LogWeb > ---src(testlog.java > ---WebContent > META-INF(log4j.properties) > WEB-INF > index.jsp > ---- > > Why it can't find out file META-INF/log4j.properties? > > Anyone can figure it out? Thanks. > -- View this message in context: http://www.nabble.com/log4jResource-setting-in-GBean%3A-ApplicationLog4jConfigurationGBean-tp23936783s134p23938431.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.