geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "viola.lu" <viola...@gmail.com>
Subject Re: log4jResource setting in GBean: ApplicationLog4jConfigurationGBean
Date Fri, 10 Jul 2009 00:37:05 GMT

Can you attach your application here and your geronimo server version?
thanks.

djencks wrote:
> 
> 
> On Jun 8, 2009, at 11:03 PM, 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?
> 
> Because that's not in your classpath.
> 
> Try WEB-INF/classes/META-INF/log4j.properties.
> 
> thanks
> david jencks
> 
>>
>>
>> Anyone can figure it out? Thanks.
>> -- 
>> View this message in context:
>> http://www.nabble.com/log4jResource-setting-in-GBean%3A-ApplicationLog4jConfigurationGBean-tp23936783s134p23936783.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/log4jResource-setting-in-GBean%3A-ApplicationLog4jConfigurationGBean-tp23936783s134p24420049.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message