You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Chathura Priyankara <pr...@gmail.com> on 2015/04/27 12:30:11 UTC

[Dev][log4j2]Use log4j 1.2 and log4j 2.2 together

Hi,

Currently I'm working on upgrading an application from log4j 1.2.17 to
log4j 2.2. This application use some third party applications like Axis2
which use log4j 1.2.x.

So I need to use both log4j 1.2 and log4j 2.2 together to make this
application work.
Is this possible to do ?

Thanks,
Regards,
Chathura

-- 
Chathura Priyankara,
Faculty of Information Technology,
University of Moratuwa.
Blog  : www.codeoncloud.blogspot.com

Re: [Dev][log4j2]Use log4j 1.2 and log4j 2.2 together

Posted by Chathura Priyankara <pr...@gmail.com>.
Hi Remco,

That is great.
Thank you very much.

Regards,
Chathura.

On Mon, Apr 27, 2015 at 5:34 PM, Remko Popma <re...@gmail.com> wrote:

> Yes, log4j.properties are ignored.
>
> However, your log4j2 config can capture all events. The simplest way is to
> configure a root logger at trace level, with a file appender. This file
> will then contain all log events, both from your app as well as from the
> 3rd part libraries.
>
> If you want to split this up, you will need to configure this in the
> log4j2 config.
>
> Sent from my iPhone
>
> On 2015/04/27, at 20:32, Chathura Priyankara <pr...@gmail.com>
> wrote:
>
> Hi Remco,
>
> Thank you very much for the response. That is really helpful.
> but still I have some problems.
>
> 1. Does that means If I use log4j-1.2-api-2.2 bridge in my application is
> it ignore all log4j.properties files ?
> If it is the case the log4j.properties files inside third party libraries
> will be ignored and logs form those applications will not appear.
>
> Thanks!
> Chathura.
>
>
> On Mon, Apr 27, 2015 at 4:42 PM, Remko Popma <re...@gmail.com>
> wrote:
>
>> Log4j2 includes an adapter so that calls to the log4j-1.2 API are
>> forwarded to the log4j2 implementation.
>>
>> To use this, put the log4j-1.2-api-2.2.jar in the classpath and remove
>> the log4j-1.2.17.jar from the classpath.
>>
>> Configuration for log4j-1.2 will be ignored. Only the log4j2 config will
>> be used.
>>
>> Sent from my iPhone
>>
>> On 2015/04/27, at 19:30, Chathura Priyankara <pr...@gmail.com>
>> wrote:
>>
>> Hi,
>>
>> Currently I'm working on upgrading an application from log4j 1.2.17 to
>> log4j 2.2. This application use some third party applications like Axis2
>> which use log4j 1.2.x.
>>
>> So I need to use both log4j 1.2 and log4j 2.2 together to make this
>> application work.
>> Is this possible to do ?
>>
>> Thanks,
>> Regards,
>> Chathura
>>
>> --
>> Chathura Priyankara,
>> Faculty of Information Technology,
>> University of Moratuwa.
>> Blog  : www.codeoncloud.blogspot.com
>>
>>
>
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com
>
>


-- 
Chathura Priyankara,
Faculty of Information Technology,
University of Moratuwa.
Blog  : www.codeoncloud.blogspot.com

Re: [Dev][log4j2]Use log4j 1.2 and log4j 2.2 together

Posted by Remko Popma <re...@gmail.com>.
Yes, log4j.properties are ignored. 

However, your log4j2 config can capture all events. The simplest way is to configure a root logger at trace level, with a file appender. This file will then contain all log events, both from your app as well as from the 3rd part libraries. 

If you want to split this up, you will need to configure this in the log4j2 config. 

Sent from my iPhone

> On 2015/04/27, at 20:32, Chathura Priyankara <pr...@gmail.com> wrote:
> 
> Hi Remco,
> 
> Thank you very much for the response. That is really helpful.
> but still I have some problems.
> 
> 1. Does that means If I use log4j-1.2-api-2.2 bridge in my application is it ignore all log4j.properties files ?
> If it is the case the log4j.properties files inside third party libraries will be ignored and logs form those applications will not appear.
> 
> Thanks!
> Chathura.
> 
> 
>> On Mon, Apr 27, 2015 at 4:42 PM, Remko Popma <re...@gmail.com> wrote:
>> Log4j2 includes an adapter so that calls to the log4j-1.2 API are forwarded to the log4j2 implementation. 
>> 
>> To use this, put the log4j-1.2-api-2.2.jar in the classpath and remove the log4j-1.2.17.jar from the classpath. 
>> 
>> Configuration for log4j-1.2 will be ignored. Only the log4j2 config will be used. 
>> 
>> Sent from my iPhone
>> 
>>> On 2015/04/27, at 19:30, Chathura Priyankara <pr...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Currently I'm working on upgrading an application from log4j 1.2.17 to log4j 2.2. This application use some third party applications like Axis2 which use log4j 1.2.x. 
>>> 
>>> So I need to use both log4j 1.2 and log4j 2.2 together to make this application work. 
>>> Is this possible to do ?
>>> 
>>> Thanks,
>>> Regards,
>>> Chathura
>>> 
>>> -- 
>>> Chathura Priyankara,
>>> Faculty of Information Technology,
>>> University of Moratuwa.
>>> Blog  : www.codeoncloud.blogspot.com
> 
> 
> 
> -- 
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com

Re: [Dev][log4j2]Use log4j 1.2 and log4j 2.2 together

Posted by Chathura Priyankara <pr...@gmail.com>.
Hi Remco,

Thank you very much for the response. That is really helpful.
but still I have some problems.

1. Does that means If I use log4j-1.2-api-2.2 bridge in my application is
it ignore all log4j.properties files ?
If it is the case the log4j.properties files inside third party libraries
will be ignored and logs form those applications will not appear.

Thanks!
Chathura.


On Mon, Apr 27, 2015 at 4:42 PM, Remko Popma <re...@gmail.com> wrote:

> Log4j2 includes an adapter so that calls to the log4j-1.2 API are
> forwarded to the log4j2 implementation.
>
> To use this, put the log4j-1.2-api-2.2.jar in the classpath and remove the
> log4j-1.2.17.jar from the classpath.
>
> Configuration for log4j-1.2 will be ignored. Only the log4j2 config will
> be used.
>
> Sent from my iPhone
>
> On 2015/04/27, at 19:30, Chathura Priyankara <pr...@gmail.com>
> wrote:
>
> Hi,
>
> Currently I'm working on upgrading an application from log4j 1.2.17 to
> log4j 2.2. This application use some third party applications like Axis2
> which use log4j 1.2.x.
>
> So I need to use both log4j 1.2 and log4j 2.2 together to make this
> application work.
> Is this possible to do ?
>
> Thanks,
> Regards,
> Chathura
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com
>
>


-- 
Chathura Priyankara,
Faculty of Information Technology,
University of Moratuwa.
Blog  : www.codeoncloud.blogspot.com

Re: [Dev][log4j2]Use log4j 1.2 and log4j 2.2 together

Posted by Remko Popma <re...@gmail.com>.
Log4j2 includes an adapter so that calls to the log4j-1.2 API are forwarded to the log4j2 implementation. 

To use this, put the log4j-1.2-api-2.2.jar in the classpath and remove the log4j-1.2.17.jar from the classpath. 

Configuration for log4j-1.2 will be ignored. Only the log4j2 config will be used. 

Sent from my iPhone

> On 2015/04/27, at 19:30, Chathura Priyankara <pr...@gmail.com> wrote:
> 
> Hi,
> 
> Currently I'm working on upgrading an application from log4j 1.2.17 to log4j 2.2. This application use some third party applications like Axis2 which use log4j 1.2.x. 
> 
> So I need to use both log4j 1.2 and log4j 2.2 together to make this application work. 
> Is this possible to do ?
> 
> Thanks,
> Regards,
> Chathura
> 
> -- 
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com