You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ravi Kumar <ra...@tibco.com.INVALID> on 2021/07/20 20:05:32 UTC

Log4j2 logging with Tomcat 9 web app

Hi,

My web app is based on Tomcat 9.0.45 server. I have migrated from Tomcat 7
to Tomcat 9 and from log4j 1.x to log4j 2.x.
I have updated the log4j2.properties as per log4j 2.x standard, still my
tomcat.log file is not getting generated and all the application log are
coming on console instead of redirecting this to tomcat.log file.

so 1.tomcat.log is not geting  generated
     2. all the contents are logging and showing on the application console
instead of getting this logged inside the tomcat.log file.

Tomcat 9.0.45 + log4j 2.14.1 is used.

I am also attaching my log4j property file. Please find this attached here.

Kindly suggest me the solution.

Thank you.
Ravi

RE: Log4j2 logging with Tomcat 9 web app

Posted by "Berneburg, Cris J. - US" <cb...@caci.com.INVALID>.
Hi Ravi  :-)

> My web app is based on Tomcat 9.0.45 server. I have migrated from Tomcat 7 to Tomcat 9
> and from log4j 1.x to log4j 2.x.  I have updated the log4j2.properties as per log4j 2.x standard,
> still my tomcat.log file is not getting generated and all the application log are coming on
> console instead of redirecting this to tomcat.log file.  So
> 1.tomcat.log is not geting  generated
> 2. all the contents are logging and showing on the application console instead of getting this
> logged inside the tomcat.log file.
> Tomcat 9.0.45 + log4j 2.14.1 is used. I am also attaching my log4j property file.
> Please find this attached here.
> Kindly suggest me the solution.
> Thank you.

Thanks for supplying your "log4j2.properties" file.  (Actually, I kind of surprised the file was delivered intact, since the mailing list usually strips attachments.)  That properties file tells Log4j2 how to perform logging.  How did you tell Tomcat to use Log4j2?

FYI, I'm a little rusty as Log4j2.

--
Cris Berneburg
CACI Senior Software Engineer


________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.

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


Re: Log4j2 logging with Tomcat 9 web app

Posted by Ravi Kumar <ra...@tibco.com.INVALID>.
Hey Mark,
Thanks for the link. But this doesn't help me resolve the issue with my
Tomcaat9- log4j2 web-based application.
Request you to provide any more info from log4j2.x-tomcat 9 level logging.

Regards,
Ravi


On Wed, Jul 21, 2021 at 2:15 PM Mark Thomas <ma...@apache.org> wrote:

> On 20/07/2021 21:05, Ravi Kumar wrote:
> > Hi,
> >
> > My web app is based on Tomcat 9.0.45 server. I have migrated from Tomcat
> > 7 to Tomcat 9 and from log4j 1.x to log4j 2.x.
> > I have updated the log4j2.properties as per log4j 2.x standard, still my
> > tomcat.log file is not getting generated and all the application log are
> > coming on console instead of redirecting this to tomcat.log file.
> >
> > so 1.tomcat.log is not geting  generated
> >       2. all the contents are logging and showing on the application
> > console instead of getting this logged inside the tomcat.log file.
> >
> > Tomcat 9.0.45 + log4j 2.14.1 is used.
> >
> > I am also attaching my log4j property file. Please find this attached
> here.
> >
> > Kindly suggest me the solution.
>
> https://logging.apache.org/log4j/2.x/log4j-jul/index.html
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Log4j2 logging with Tomcat 9 web app

Posted by Mark Thomas <ma...@apache.org>.
On 20/07/2021 21:05, Ravi Kumar wrote:
> Hi,
> 
> My web app is based on Tomcat 9.0.45 server. I have migrated from Tomcat 
> 7 to Tomcat 9 and from log4j 1.x to log4j 2.x.
> I have updated the log4j2.properties as per log4j 2.x standard, still my 
> tomcat.log file is not getting generated and all the application log are 
> coming on console instead of redirecting this to tomcat.log file.
> 
> so 1.tomcat.log is not geting  generated
>       2. all the contents are logging and showing on the application 
> console instead of getting this logged inside the tomcat.log file.
> 
> Tomcat 9.0.45 + log4j 2.14.1 is used.
> 
> I am also attaching my log4j property file. Please find this attached here.
> 
> Kindly suggest me the solution.

https://logging.apache.org/log4j/2.x/log4j-jul/index.html

Mark

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