You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Anjib Mulepati <an...@hotmail.com> on 2012/01/09 18:24:19 UTC

log4j in two different project

I have two different projects
a) One for my DAO and
b) Another for my web application.
Web application uses the DAO jar file to handle all DAO operations.
In both project I have configured the log4j.properties (lo4j-1.2.14)
file and using commons-logging 1.1.1.
When I run test code independently in DAO project I can see the log but
when I try to see the log for DAO by running my application DAO logs are
not generated I can only see the logs from my web application.
What I am doing wrong?


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j in two different project

Posted by Anjib Mulepati <an...@hotmail.com>.
Yes I think that I have to config the log for DAO also but don't know 
how to do that.

I have log4j.properties file in the default package inside the DAO.

How can I do that in webapp. I mean how I get its location?


On 1/9/2012 4:37 PM, Jacob Kjome wrote:
>
> Are you log4j.properties files for each project identical?  My guess 
> is that they are different and the config file for you webapp doesn't 
> provide the configuration you require for your DAO.
>
> BTW, is the DAO project deployed in WEB-INF/lib?  That is, is it part 
> of the same classloader as the webapp.  That could be an issue as well 
> if it is not.
>
> Jake
>
> On Mon, 9 Jan 2012 12:24:19 -0500
>  Anjib Mulepati <an...@hotmail.com> wrote:
>> I have two different projects
>> a) One for my DAO and
>> b) Another for my web application.
>> Web application uses the DAO jar file to handle all DAO operations.
>> In both project I have configured the log4j.properties (lo4j-1.2.14)
>> file and using commons-logging 1.1.1.
>> When I run test code independently in DAO project I can see the log but
>> when I try to see the log for DAO by running my application DAO logs are
>> not generated I can only see the logs from my web application.
>> What I am doing wrong?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j in two different project

Posted by Jacob Kjome <ho...@visi.com>.
On Thu, 12 Jan 2012 10:13:20 -0500
 Anjib Mulepati <an...@hotmail.com> wrote:
> Hi
> 
> Is there any help I can get in this?
> 
>  * Are you log4j.properties files for each project identical?
>      o No
>  * the config file for you webapp doesn't provide the configuration you
>    require for your DAO
>      o How to do this? What does this mean?

Because your DAO project (jar file) runs within the context of your webaapp 
and Log4j provides only a single configuration context per webapp (assuming 
Log4j.jar is deployed in WEB-INF/lib and you are using child-first 
classloading), then you need your config file to encompass the configuration 
for all applicable libraries.  In this sense, you shouldn't think of your DAO 
project as something separate from the webapp.  It's really a library 
dependency of the webapp, making it, for all intents and purposes, part of a 
single application.

>  * is the DAO project deployed in WEB-INF/lib
>      o What does this mean? how I can check?
> 
> 

I presume your DAO project is represented as a jar file, no?  If you use it as 
part of your webapp, then it must a library dependency of the webapp.  If it 
is a library dependency of your webapp, then you normally deploy this in 
WEB-INF/lib.  I'll leave it at that.


Jake

> 
> 
> Thanks,
> Anjib
> On 1/9/2012 4:37 PM, Jacob Kjome wrote:
>>
>> Are you log4j.properties files for each project identical?  My guess is that 
>>they are different and the config file for you webapp doesn't provide the 
>>configuration you require for your DAO.
>>
>> BTW, is the DAO project deployed in WEB-INF/lib?  That is, is it part of the 
>>same classloader as the webapp.  That could be an issue as well if it is not.
>>
>> Jake
>>
>> On Mon, 9 Jan 2012 12:24:19 -0500
>>  Anjib Mulepati <an...@hotmail.com> wrote:
>>> I have two different projects
>>> a) One for my DAO and
>>> b) Another for my web application.
>>> Web application uses the DAO jar file to handle all DAO operations.
>>> In both project I have configured the log4j.properties (lo4j-1.2.14)
>>> file and using commons-logging 1.1.1.
>>> When I run test code independently in DAO project I can see the log but
>>> when I try to see the log for DAO by running my application DAO logs are
>>> not generated I can only see the logs from my web application.
>>> What I am doing wrong?
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j in two different project

Posted by Anjib Mulepati <an...@hotmail.com>.
Hi

Is there any help I can get in this?

  * Are you log4j.properties files for each project identical?
      o No
  * the config file for you webapp doesn't provide the configuration you
    require for your DAO
      o How to do this? What does this mean?
  * is the DAO project deployed in WEB-INF/lib
      o What does this mean? how I can check?




Thanks,
Anjib
On 1/9/2012 4:37 PM, Jacob Kjome wrote:
>
> Are you log4j.properties files for each project identical?  My guess 
> is that they are different and the config file for you webapp doesn't 
> provide the configuration you require for your DAO.
>
> BTW, is the DAO project deployed in WEB-INF/lib?  That is, is it part 
> of the same classloader as the webapp.  That could be an issue as well 
> if it is not.
>
> Jake
>
> On Mon, 9 Jan 2012 12:24:19 -0500
>  Anjib Mulepati <an...@hotmail.com> wrote:
>> I have two different projects
>> a) One for my DAO and
>> b) Another for my web application.
>> Web application uses the DAO jar file to handle all DAO operations.
>> In both project I have configured the log4j.properties (lo4j-1.2.14)
>> file and using commons-logging 1.1.1.
>> When I run test code independently in DAO project I can see the log but
>> when I try to see the log for DAO by running my application DAO logs are
>> not generated I can only see the logs from my web application.
>> What I am doing wrong?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>


Re: log4j in two different project

Posted by Jacob Kjome <ho...@visi.com>.
Are you log4j.properties files for each project identical?  My guess is that 
they are different and the config file for you webapp doesn't provide the 
configuration you require for your DAO.

BTW, is the DAO project deployed in WEB-INF/lib?  That is, is it part of the 
same classloader as the webapp.  That could be an issue as well if it is not.

Jake

On Mon, 9 Jan 2012 12:24:19 -0500
 Anjib Mulepati <an...@hotmail.com> wrote:
> I have two different projects
> a) One for my DAO and
> b) Another for my web application.
> Web application uses the DAO jar file to handle all DAO operations.
> In both project I have configured the log4j.properties (lo4j-1.2.14)
> file and using commons-logging 1.1.1.
> When I run test code independently in DAO project I can see the log but
> when I try to see the log for DAO by running my application DAO logs are
> not generated I can only see the logs from my web application.
> What I am doing wrong?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org