You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jason Novotny <no...@gridsphere.org> on 2006/10/14 07:19:25 UTC
using commons-logging in webapp w/ log4j, can't find my properties
Hi,
I have a webapp and I have deployed common-logging-1.1 jar and
log4j-1.2.11 in my WEB-INF/lib directory of my webapp. I have also place
a log4j.properties file in my WEB-INF/classes directory. However, when
the webapp runs, I see only INFO level is being logged. It all worked
fine when I placed some line of the form
PropertyConfigurator.configure(url);
which forces a log4j to use the supplied config file, however I didn't
think this was necessary--
Any help is greatly appreciated!
Thanks, Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: using commons-logging in webapp w/ log4j, can't find my properties
Posted by Jason Novotny <no...@gridsphere.org>.
I think I see my problem--
My webapp first invokes a set of classes that are located in the
shared/lib classpath of Tomcat. Those classes also use commons-logging,
however there is no commons-logging jar in shared/lib alongside them, My
hunch is they make use of the commons-logging.jar located in Tomcat/bin
directory that ships with tomcat. Then it would seem that when execution
returns to my webapp, Tomcat classloading magic will just continue to
use the default logging properties and not my log4j.properties file.
I can manually make it all work just by doing
PropertyConfigurator.configure(config.getServletContext().getRealPath("/WEB-INF/classes/log4j.properties"));
at the top of my servlet, so I guess this appears to the best solution
for now.
Jason
Dennis Lundberg wrote:
> I'd suggest that you take a look at the troubleshooting guide for
> commons-logging, especially the section on how to turn on "Diagnostic
> logging":
>
> http://jakarta.apache.org/commons/logging/troubleshooting.html#Using_JCL_Diagnostics
>
>
> That will show you what commons-logging is up to and where it finds
> its configuration.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: using commons-logging in webapp w/ log4j, can't find my properties
Posted by Dennis Lundberg <de...@apache.org>.
I'd suggest that you take a look at the troubleshooting guide for
commons-logging, especially the section on how to turn on "Diagnostic
logging":
http://jakarta.apache.org/commons/logging/troubleshooting.html#Using_JCL_Diagnostics
That will show you what commons-logging is up to and where it finds its
configuration.
--
Dennis Lundberg
Jason Novotny wrote:
>
> Thanks-- I'm using Tomcat 5.5.17... I guess one question is how do I
> log the logger? There must be some way to see where it is looking for
> the appropriate properties file. I imagine that commons-logging classes
> can see the log4j classes in the same classpath and then start looking
> for the properties file in a few places...
>
> Thanks, Jason
>
> Dennis Lundberg wrote:
>> Jason Novotny wrote:
>>>
>>> Hi,
>>>
>>> I have a webapp and I have deployed common-logging-1.1 jar and
>>> log4j-1.2.11 in my WEB-INF/lib directory of my webapp. I have also
>>> place a log4j.properties file in my WEB-INF/classes directory.
>>> However, when the webapp runs, I see only INFO level is being logged.
>>> It all worked fine when I placed some line of the form
>>>
>>> PropertyConfigurator.configure(url);
>>>
>>> which forces a log4j to use the supplied config file, however I
>>> didn't think this was necessary--
>>>
>>> Any help is greatly appreciated!
>>>
>>> Thanks, Jason
>>
>> Hi Jason
>>
>> We have been using a setup just like yours on Tomcat for a long time.
>> Recently we switched from log4j.properties to log4j.xml and just place
>> the xml file in WEB-INF/classes as well.
>>
>> What container are you running your application on?
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: using commons-logging in webapp w/ log4j, can't find my properties
Posted by Jason Novotny <no...@gridsphere.org>.
Thanks-- I'm using Tomcat 5.5.17... I guess one question is how do I
log the logger? There must be some way to see where it is looking for
the appropriate properties file. I imagine that commons-logging classes
can see the log4j classes in the same classpath and then start looking
for the properties file in a few places...
Thanks, Jason
Dennis Lundberg wrote:
> Jason Novotny wrote:
>>
>> Hi,
>>
>> I have a webapp and I have deployed common-logging-1.1 jar and
>> log4j-1.2.11 in my WEB-INF/lib directory of my webapp. I have also
>> place a log4j.properties file in my WEB-INF/classes directory.
>> However, when the webapp runs, I see only INFO level is being logged.
>> It all worked fine when I placed some line of the form
>>
>> PropertyConfigurator.configure(url);
>>
>> which forces a log4j to use the supplied config file, however I
>> didn't think this was necessary--
>>
>> Any help is greatly appreciated!
>>
>> Thanks, Jason
>
> Hi Jason
>
> We have been using a setup just like yours on Tomcat for a long time.
> Recently we switched from log4j.properties to log4j.xml and just place
> the xml file in WEB-INF/classes as well.
>
> What container are you running your application on?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: using commons-logging in webapp w/ log4j, can't find my properties
Posted by Dennis Lundberg <de...@apache.org>.
Jason Novotny wrote:
>
> Hi,
>
> I have a webapp and I have deployed common-logging-1.1 jar and
> log4j-1.2.11 in my WEB-INF/lib directory of my webapp. I have also place
> a log4j.properties file in my WEB-INF/classes directory. However, when
> the webapp runs, I see only INFO level is being logged. It all worked
> fine when I placed some line of the form
>
> PropertyConfigurator.configure(url);
>
> which forces a log4j to use the supplied config file, however I didn't
> think this was necessary--
>
> Any help is greatly appreciated!
>
> Thanks, Jason
Hi Jason
We have been using a setup just like yours on Tomcat for a long time.
Recently we switched from log4j.properties to log4j.xml and just place
the xml file in WEB-INF/classes as well.
What container are you running your application on?
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org