You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Christoph Nenning <Ch...@lex-com.net> on 2015/08/07 10:28:04 UTC

Re: [VOTE] Struts 2.5 BETA1

> Wait but Log4j2 can Log4j directly

How to configure that?

Beside the approach I posted earlier I only found the other solution to 
throw log4j1 stuff away and create a log4j2 config. Therefore I needed 
these 2 jars: log4j-core and log4j-slf4j-impl.
But that caused log messages sent via slf4j-api to appear twice. So more 
fiddling is required.



@Greg
> So it wants log4j-core?
> I use org.apache.commons.logging.LogFactory  to log stuff in my app.

In your case you would have to add these 2 jars:
- log4j-core
- log4j-jcl
And you would need to create a log4j2 config.


The other approach would be to forward log4j2 messages to commons-logging. 
But there seems to be no jar that implements that right now.




Regards,
Christoph





> From: Lukasz Lenart <lu...@apache.org>
> To: Struts Developers List <de...@struts.apache.org>, 
> Date: 30.07.2015 10:49
> Subject: Re: [VOTE] Struts 2.5 BETA1
> 
> Wait but Log4j2 can Log4j directly
> 
> 2015-07-30 10:46 GMT+02:00 Christoph Nenning 
<Ch...@lex-com.net>:
> > In my test app I am using slf4j with log4j1.
> >
> > As a fast and quick workaround I am using these jars:
> >
> > - slf4j-api
> > - slf4j-log4j12
> > - log4j
> > - log4j-to-slf4j
> >
> >
> > That means struts log messages are forwarded like this:
> > struts -> log4j2 -> slf4j -> log4j1
> >
> >
> > Might not make much sense but got the test app running fast.
> >
> >
> >
> > Regards,
> > Christoph
> >
> >
> >
> >> From: Greg Huber <gr...@gmail.com>
> >> To: Struts Developers List <de...@struts.apache.org>,
> >> Date: 30.07.2015 10:29
> >> Subject: Re: [VOTE] Struts 2.5 BETA1
> >>
> >> I am seeing this on my console output for tomcat:
> >>
> >> ERROR StatusLogger Log4j2 could not find a logging implementation.
> > Please
> >> add log4j-core to the classpath. Using SimpleLogger to log to the
> > console...
> >>
> >> Any ideas?
> >>
> >> There is no log4j-core, would I need to add this manually to my pom?
> >>
> >> /WEB-INF/lib/log4j-api-2.3.jar
> >> /WEB-INF/lib/log4j-1.2.17.jar
> >>
> >> Cheers Greg
> >>
> >>
> >> On 27 July 2015 at 19:21, Lukasz Lenart <lu...@apache.org> 
wrote:
> >>
> >> > 2015-07-27 9:19 GMT+02:00 Lukasz Lenart <lu...@apache.org>:
> >> > > [ ] Leave at test build
> >> > > [ ] Alpha
> >> > > [X] Beta
> >> > > [ ] General Availability (GA)
> >> >
> >> > +1 binding
> >> >
> >> >
> >> > Regards
> >> > --
> >> > Łukasz
> >> > + 48 606 323 122 http://www.lenart.org.pl/
> >> >
> >> > 
---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: dev-help@struts.apache.org
> >> >
> >> >
> >
> > This Email was scanned by Sophos Anti Virus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 

This Email was scanned by Sophos Anti Virus

Re: [VOTE] Struts 2.5 BETA1

Posted by Christoph Nenning <Ch...@lex-com.net>.
> I've just added these to my pom
> 
> <dependency>
>   <groupId>log4j</groupId>
>   <artifactId>log4j</artifactId>
>   <version>1.2.17</version>
> </dependency>


I had the same dependency. Even before struts 2.5-beta. With that I get 
the same error as Greg:

> ERROR StatusLogger Log4j2 could not find a logging implementation. 
> Please add log4j-core to the classpath. Using SimpleLogger to log to the 
console...

And there were no struts log messages at all.

As you don't get that error it may be specific to the app-server. I'm 
bound to WebSphere for this app.




> Here is more infor about Log4j 1.x bridge
> http://logging.apache.org/log4j/2.x/manual/migration.html

That basically means to re-write logging config for log4j2, which I had 
already to do for the approach in my previous post. (the other approach 
was just to use log4j2 as logging impl)



Regards and have a nice weekend,
Christoph




> From: Lukasz Lenart <lu...@apache.org>
> To: Struts Developers List <de...@struts.apache.org>, 
> Date: 07.08.2015 15:09
> Subject: Re: [VOTE] Struts 2.5 BETA1
> 
> 2015-08-07 10:28 GMT+02:00 Christoph Nenning 
<Ch...@lex-com.net>:
> >> Wait but Log4j2 can Log4j directly
> >
> > How to configure that?
> 
> I've just added these to my pom
> 
> <dependency>
>   <groupId>log4j</groupId>
>   <artifactId>log4j</artifactId>
>   <version>1.2.17</version>
> </dependency>
> 
> and it works
> 
> > Beside the approach I posted earlier I only found the other solution 
to
> > throw log4j1 stuff away and create a log4j2 config. Therefore I needed
> > these 2 jars: log4j-core and log4j-slf4j-impl.
> > But that caused log messages sent via slf4j-api to appear twice. So 
more
> > fiddling is required.
> 
> Here is more infor about Log4j 1.x bridge
> http://logging.apache.org/log4j/2.x/manual/migration.html
> 
> 
> Regards
> -- 
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 

This Email was scanned by Sophos Anti Virus

Re: [VOTE] Struts 2.5 BETA1

Posted by Lukasz Lenart <lu...@apache.org>.
2015-08-07 10:28 GMT+02:00 Christoph Nenning <Ch...@lex-com.net>:
>> Wait but Log4j2 can Log4j directly
>
> How to configure that?

I've just added these to my pom

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.17</version>
</dependency>

and it works

> Beside the approach I posted earlier I only found the other solution to
> throw log4j1 stuff away and create a log4j2 config. Therefore I needed
> these 2 jars: log4j-core and log4j-slf4j-impl.
> But that caused log messages sent via slf4j-api to appear twice. So more
> fiddling is required.

Here is more infor about Log4j 1.x bridge
http://logging.apache.org/log4j/2.x/manual/migration.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [VOTE] Struts 2.5 BETA1

Posted by Christoph Nenning <Ch...@lex-com.net>.
> But that caused log messages sent via slf4j-api to appear twice.
> So more fiddling is required.

In case anybody wonders, that was just due to logger additivity:


http://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity



Regards,
Christoph



> From: Christoph Nenning <Ch...@lex-com.net>
> To: "Struts Developers List" <de...@struts.apache.org>, 
> Date: 07.08.2015 10:29
> Subject: Re: [VOTE] Struts 2.5 BETA1
> 
> > Wait but Log4j2 can Log4j directly
> 
> How to configure that?
> 
> Beside the approach I posted earlier I only found the other solution to 
> throw log4j1 stuff away and create a log4j2 config. Therefore I needed 
> these 2 jars: log4j-core and log4j-slf4j-impl.
> But that caused log messages sent via slf4j-api to appear twice. So more 

> fiddling is required.
> 
> 
> 
> @Greg
> > So it wants log4j-core?
> > I use org.apache.commons.logging.LogFactory  to log stuff in my app.
> 
> In your case you would have to add these 2 jars:
> - log4j-core
> - log4j-jcl
> And you would need to create a log4j2 config.
> 
> 
> The other approach would be to forward log4j2 messages to 
commons-logging. 
> But there seems to be no jar that implements that right now.
> 
> 
> 
> 
> Regards,
> Christoph
> 
> 
> 
> 
> 
> > From: Lukasz Lenart <lu...@apache.org>
> > To: Struts Developers List <de...@struts.apache.org>, 
> > Date: 30.07.2015 10:49
> > Subject: Re: [VOTE] Struts 2.5 BETA1
> > 
> > Wait but Log4j2 can Log4j directly
> > 
> > 2015-07-30 10:46 GMT+02:00 Christoph Nenning 
> <Ch...@lex-com.net>:
> > > In my test app I am using slf4j with log4j1.
> > >
> > > As a fast and quick workaround I am using these jars:
> > >
> > > - slf4j-api
> > > - slf4j-log4j12
> > > - log4j
> > > - log4j-to-slf4j
> > >
> > >
> > > That means struts log messages are forwarded like this:
> > > struts -> log4j2 -> slf4j -> log4j1
> > >
> > >
> > > Might not make much sense but got the test app running fast.
> > >
> > >
> > >
> > > Regards,
> > > Christoph
> > >
> > >
> > >
> > >> From: Greg Huber <gr...@gmail.com>
> > >> To: Struts Developers List <de...@struts.apache.org>,
> > >> Date: 30.07.2015 10:29
> > >> Subject: Re: [VOTE] Struts 2.5 BETA1
> > >>
> > >> I am seeing this on my console output for tomcat:
> > >>
> > >> ERROR StatusLogger Log4j2 could not find a logging implementation.
> > > Please
> > >> add log4j-core to the classpath. Using SimpleLogger to log to the
> > > console...
> > >>
> > >> Any ideas?
> > >>
> > >> There is no log4j-core, would I need to add this manually to my 
pom?
> > >>
> > >> /WEB-INF/lib/log4j-api-2.3.jar
> > >> /WEB-INF/lib/log4j-1.2.17.jar
> > >>
> > >> Cheers Greg
> > >>
> > >>
> > >> On 27 July 2015 at 19:21, Lukasz Lenart <lu...@apache.org> 
> wrote:
> > >>
> > >> > 2015-07-27 9:19 GMT+02:00 Lukasz Lenart 
<lu...@apache.org>:
> > >> > > [ ] Leave at test build
> > >> > > [ ] Alpha
> > >> > > [X] Beta
> > >> > > [ ] General Availability (GA)
> > >> >
> > >> > +1 binding
> > >> >
> > >> >
> > >> > Regards
> > >> > --
> > >> > Łukasz
> > >> > + 48 606 323 122 http://www.lenart.org.pl/
> > >> >
> > >> > 
> ---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > >> > For additional commands, e-mail: dev-help@struts.apache.org
> > >> >
> > >> >
> > >
> > > This Email was scanned by Sophos Anti Virus
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> > 
> 
> This Email was scanned by Sophos Anti Virus

This Email was scanned by Sophos Anti Virus