You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Niranjan Rao <nh...@gmail.com> on 2021/06/29 00:11:28 UTC

Using log4j for logging

Greetings,

I wanted to setup log4j for tomcat logs and google searches seems to 
indicate that this is possible. Many articles speak about downloading 
tomcat-juli-adapters.jar from bin/extras directory.

I found out that for tomcat version 9, extras directory is last present 
on version 9.0.14 
(https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.14/bin/). Latter 
versions do not have extras directory.

Is tomcat-juli-adapters file no longer required? What will be the best 
way to configure tomcat logs using log4j.


My main interest is uploading access logs and catalina.out to AWS/S3 
bucket. For our application logs, we are already doing this. If there is 
a better way to achieve this, open to that solution too.


Regards,

Niranjan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using log4j for logging

Posted by Mark Thomas <ma...@apache.org>.
On 29/06/2021 17:53, Niranjan Rao wrote:
> We are actually using log4j2, I should have been more clearer.

Ack.

> Does this mean we don't have to use specialized juli jar and adapters 
> and many of the stackoverflow answers are out of date?

Yes.

> I have seen 
> answers saying download juli adapter version from tomcat version 7 and 
> use it for 9 or similar.

I guess that might work but I'd be surprised.

Mark

> 
> Regards,
> 
> Niranjan
> 
> On 6/29/21 12:24 AM, Mark Thomas wrote:
>> On 29/06/2021 01:11, Niranjan Rao wrote:
>>> Greetings,
>>>
>>> I wanted to setup log4j for tomcat logs and google searches seems to 
>>> indicate that this is possible. Many articles speak about downloading 
>>> tomcat-juli-adapters.jar from bin/extras directory.
>>>
>>> I found out that for tomcat version 9, extras directory is last 
>>> present on version 9.0.14 
>>> (https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.14/bin/). 
>>> Latter versions do not have extras directory.
>>>
>>> Is tomcat-juli-adapters file no longer required? What will be the 
>>> best way to configure tomcat logs using log4j.
>>
>> log4j was declared end of life in 2015. If you really need to use 
>> log4j then there are some pointers here:
>>
>> https://stackoverflow.com/questions/869945/how-to-send-java-util-logging-to-log4j 
>>
>>
>> I'd recommend the answer from Emmanuel Bourg.
>>
>> If you are using log4j2 then you can use:
>> https://logging.apache.org/log4j/2.x/log4j-jpl/index.html
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using log4j for logging

Posted by Niranjan Rao <nh...@gmail.com>.
We are actually using log4j2, I should have been more clearer.

Does this mean we don't have to use specialized juli jar and adapters 
and many of the stackoverflow answers are out of date? I have seen 
answers saying download juli adapter version from tomcat version 7 and 
use it for 9 or similar.

Regards,

Niranjan

On 6/29/21 12:24 AM, Mark Thomas wrote:
> On 29/06/2021 01:11, Niranjan Rao wrote:
>> Greetings,
>>
>> I wanted to setup log4j for tomcat logs and google searches seems to 
>> indicate that this is possible. Many articles speak about downloading 
>> tomcat-juli-adapters.jar from bin/extras directory.
>>
>> I found out that for tomcat version 9, extras directory is last 
>> present on version 9.0.14 
>> (https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.14/bin/). 
>> Latter versions do not have extras directory.
>>
>> Is tomcat-juli-adapters file no longer required? What will be the 
>> best way to configure tomcat logs using log4j.
>
> log4j was declared end of life in 2015. If you really need to use 
> log4j then there are some pointers here:
>
> https://stackoverflow.com/questions/869945/how-to-send-java-util-logging-to-log4j 
>
>
> I'd recommend the answer from Emmanuel Bourg.
>
> If you are using log4j2 then you can use:
> https://logging.apache.org/log4j/2.x/log4j-jpl/index.html
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using log4j for logging

Posted by Mark Thomas <ma...@apache.org>.
On 29/06/2021 01:11, Niranjan Rao wrote:
> Greetings,
> 
> I wanted to setup log4j for tomcat logs and google searches seems to 
> indicate that this is possible. Many articles speak about downloading 
> tomcat-juli-adapters.jar from bin/extras directory.
> 
> I found out that for tomcat version 9, extras directory is last present 
> on version 9.0.14 
> (https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.14/bin/). Latter 
> versions do not have extras directory.
> 
> Is tomcat-juli-adapters file no longer required? What will be the best 
> way to configure tomcat logs using log4j.

log4j was declared end of life in 2015. If you really need to use log4j 
then there are some pointers here:

https://stackoverflow.com/questions/869945/how-to-send-java-util-logging-to-log4j

I'd recommend the answer from Emmanuel Bourg.

If you are using log4j2 then you can use:
https://logging.apache.org/log4j/2.x/log4j-jpl/index.html

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org