You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com> on 2018/12/18 17:42:09 UTC
log4j app logging
I have an old webapp that uses log4j 1.2 and which I am trying to deploy on tomcat. For the heck of it I can't get tomcat to use the log4.properties file. What am I doing wrong?
tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the app is working fine. The project is mavenized, I put log4.properties to src/main/resources and it ends up in the jar file of my application. Is there anything special that needs to be done?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: log4j app logging
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Michael,
On 12/18/18 13:53, Lemke, Michael ST/HZA-ZIC2 wrote:
> Thanks, Ryan, this JULI thing actually is what worries me. I don't
> care about tomcat's logging at the moment. It is my webapp's
> logging I can't figure out. It worked on other containers.
Oh, good: you are trying just to manage your own application's logging.
I have this class running as a ServletContextListener:
package xxx;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
/**
* A listener to initialize log4j.
*
* @author Chris Schultz
* @version $Revision: 17834 $ $Date: 2015-12-16 11:03:13 -0500 (Wed,
16 Dec 2015) $
*/
public class Log4jListener
implements ServletContextListener
{
private Logger logger;
@SuppressWarnings("unused")
public void contextInitialized(ServletContextEvent e)
{
// Trigger loading of the log4j.properties file from the
classpath.
new PropertyConfigurator();
logger = Logger.getLogger(this.getClass());
logger.info("Log4j initialized");
}
public void contextDestroyed(ServletContextEvent e)
{
if(LogManager.class.getClassLoader()
.equals(this.getClass().getClassLoader()))
{
if(null != logger)
logger.info("Log4j was loaded by application
classloader; shutting down.");
LogManager.shutdown();
}
else
{
if(null != logger)
logger.info("Log4j was loaded by some other
ClassLoader; not shutting down.");
}
}
}
Calling the PropertyConfigurator constructor causes that class to look
for log4j.properties in various places, including (due to the way the
WebappClassLoader works), WEB-INF/classes. It should also look in the
"top-level" of any application JAR files that are in WEB-INF/lib.
You said that "your JAR file contains log4j.properties". Usually
applications are packaged as WAR files (or exploded WAR directories).
Are you using embedded Tomcat or Spring Boot or anything like that?
Where is your JAR file located?
- -chris
> -----Original Message----- From: Ryan Palmer Sent: Tuesday,
> December 18, 2018 7:49 PM
>
> Michael,
>
> Tomcat uses JULI internally. Have you taken necessary steps to
> redirect JULI to log4j?
>
> Thanks, Ryan
>
> ________________________________ From: Lemke, Michael ST/HZA-ZIC2
> <le...@schaeffler.com> Sent: Tuesday, December 18, 2018 10:20
> AM To: Tomcat Users List Subject: RE: log4j app logging
>
> On December 18, 2018 6:59 PM Ryan Palmer wrote:
>>
>> The file needs to be named
>> log4j.properties<http://log4j.properties> (or .xml, .json, etc.)
>> and needs to be in the classpath. You ommitted the 'j'.
>
> Thanks for spotting this. Unfortunately, this typo was only in the
> email:
>
> pc# ls src/main/resources/ com log4j.properties
>
>
> So for being in the classpath it is sufficient to have it packaged
> in the jar, isn't it?
>
> Archive: myapp-1.1.0-SNAPSHOT.jar Length Method Size Cmpr
> Date Time CRC-32 Name -------- ------ ------- ----
> ---------- ----- -------- ---- 0 Stored 0 0% 12-18-2018
> 16:56 00000000 META-INF/ 98 Defl:N 91 7% 12-18-2018 16:56
> 48730e36 META-INF/MANIFEST.MF 0 Stored 0 0% 12-18-2018
> 16:56 00000000 META-INF/maven/ ... 0 Stored 0 0%
> 12-18-2018 16:56 00000000 com/ ... 1123 Defl:N 451 60%
> 12-18-2018 16:56 eea5d81a log4j.properties
>
> It ought to be something simple but before further digging into my
> setup details I want to make sure there isn't something special for
> tomcat. Something in ${catalina.base}/conf or conflicts with
> tomcat's logging system.
>
>
>> On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" wrote:
>>
>> I have an old webapp that uses log4j 1.2 and which I am trying to
>> deploy on tomcat. For the heck of it I can't get tomcat to use
>> the log4.properties<http://log4.properties> file. What am I doing
>> wrong?
>>
>> tomcat 9.0.6 is installed as a Windows service and does serve my
>> webapp, so the app is working fine. The project is mavenized, I
>> put log4.properties<http://log4.properties> to src/main/resources
>> and it ends up in the jar file of my application. Is there
>> anything special that needs to be done?
>>
>> ________________________________
>>
>> 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
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlwZUNgACgkQHPApP6U8
pFjT8w/9GjwEULflsNS+pW/6O+ADz7jHFr6FtXpv9v3N1AtdLXAt4u0tlqhJyLCg
uV0nMDkpEMhpFQVaOXwOLO/0Ygnmam9ty4dw457ePhgwEWnupg888fFHQibYqJ07
dUJ93AiWcSITt2JtH4Xlo/QeOzUgViHRP1mB5fL/Qrh163hj27MlQzg876VGhDLe
qIlZs1sPl3KWx9G7b6H1XUQG2BIYlVWYAOTSmW8xNdaYUXUEjWwtY9eVpigm1CKO
57iajYz1YBoSAViXpcNrVB0MSdcKIP64xTlDXsK45Sos7vTnS7V49O7wBWw8QRDc
HpekdyzqDFZAXrqFjif5NLrboGKN0OW+piPNzbQuz6Dh/dyYTNUx7JZRYIg/mwqd
pznunwHItCnIKQjmKuIPmWTM0fqRvyJom9HCM14xbSHBUG+p0sebyI/J8w8iZWRO
ftmBY7n654DohS0tZry6nQdsq/jGPnrxnj+psFfelV6vQ7DDx2eOak4tEoB9HTaZ
Zxm/zBrn9Yppb2kZ4xXc6wRdj59pPyUv2EpcCaGN7G8Yr0n7h1O3UTwcYr8D59Aw
FugBtgsf0mCoAAiYNo91WcUsQ3xJmUef4RtTd5VeOuTaA29azmV9IpYzjKN6gWOg
XooQL5PA9FI5w0mJZFquXfrIxuIz4T4Xyy4klaDvCKG5jvnutzM=
=vWAH
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: log4j app logging
Posted by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>.
Thanks, Ryan, this JULI thing actually is what worries me. I don't care about tomcat's logging at the moment. It is my webapp's logging I can't figure out. It worked on other containers.
-----Original Message-----
From: Ryan Palmer
Sent: Tuesday, December 18, 2018 7:49 PM
Michael,
Tomcat uses JULI internally. Have you taken necessary steps to redirect JULI to log4j?
Thanks,
Ryan
________________________________
From: Lemke, Michael ST/HZA-ZIC2 <le...@schaeffler.com>
Sent: Tuesday, December 18, 2018 10:20 AM
To: Tomcat Users List
Subject: RE: log4j app logging
On December 18, 2018 6:59 PM
Ryan Palmer wrote:
>
>The file needs to be named log4j.properties<http://log4j.properties> (or .xml, .json, etc.) and needs to be in the classpath. You ommitted the 'j'.
Thanks for spotting this. Unfortunately, this typo was only in the email:
pc# ls src/main/resources/
com log4j.properties
So for being in the classpath it is sufficient to have it packaged in the jar, isn't it?
Archive: myapp-1.1.0-SNAPSHOT.jar
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/
98 Defl:N 91 7% 12-18-2018 16:56 48730e36 META-INF/MANIFEST.MF
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/maven/
...
0 Stored 0 0% 12-18-2018 16:56 00000000 com/
...
1123 Defl:N 451 60% 12-18-2018 16:56 eea5d81a log4j.properties
It ought to be something simple but before further digging into my setup details I want to make sure there isn't something special for tomcat. Something in ${catalina.base}/conf or conflicts with tomcat's logging system.
>On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" wrote:
>
>I have an old webapp that uses log4j 1.2 and which I am trying to deploy on tomcat. For the heck of it I can't get tomcat to use the log4.properties<http://log4.properties> file. What am I doing wrong?
>
>tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the app is working fine. The project is mavenized, I put log4.properties<http://log4.properties> to src/main/resources and it ends up in the jar file of my application. Is there anything special that needs to be done?
>
>________________________________
>
>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: log4j app logging
Posted by Ryan Palmer <ry...@hotmail.com>.
Michael,
Tomcat uses JULI internally. Have you taken necessary steps to redirect JULI to log4j?
Thanks,
Ryan
________________________________
From: Lemke, Michael ST/HZA-ZIC2 <le...@schaeffler.com>
Sent: Tuesday, December 18, 2018 10:20 AM
To: Tomcat Users List
Subject: RE: log4j app logging
On December 18, 2018 6:59 PM
Ryan Palmer wrote:
>
>The file needs to be named log4j.properties<http://log4j.properties> (or .xml, .json, etc.) and needs to be in the classpath. You ommitted the 'j'.
Thanks for spotting this. Unfortunately, this typo was only in the email:
pc# ls src/main/resources/
com log4j.properties
So for being in the classpath it is sufficient to have it packaged in the jar, isn't it?
Archive: myapp-1.1.0-SNAPSHOT.jar
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/
98 Defl:N 91 7% 12-18-2018 16:56 48730e36 META-INF/MANIFEST.MF
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/maven/
...
0 Stored 0 0% 12-18-2018 16:56 00000000 com/
...
1123 Defl:N 451 60% 12-18-2018 16:56 eea5d81a log4j.properties
It ought to be something simple but before further digging into my setup details I want to make sure there isn't something special for tomcat. Something in ${catalina.base}/conf or conflicts with tomcat's logging system.
>On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" wrote:
>
>I have an old webapp that uses log4j 1.2 and which I am trying to deploy on tomcat. For the heck of it I can't get tomcat to use the log4.properties<http://log4.properties> file. What am I doing wrong?
>
>tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the app is working fine. The project is mavenized, I put log4.properties<http://log4.properties> to src/main/resources and it ends up in the jar file of my application. Is there anything special that needs to be done?
>
>________________________________
>
>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: log4j app logging
Posted by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>.
On December 18, 2018 6:59 PM
Ryan Palmer wrote:
>
>The file needs to be named log4j.properties<http://log4j.properties> (or .xml, .json, etc.) and needs to be in the classpath. You ommitted the 'j'.
Thanks for spotting this. Unfortunately, this typo was only in the email:
pc# ls src/main/resources/
com log4j.properties
So for being in the classpath it is sufficient to have it packaged in the jar, isn't it?
Archive: myapp-1.1.0-SNAPSHOT.jar
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/
98 Defl:N 91 7% 12-18-2018 16:56 48730e36 META-INF/MANIFEST.MF
0 Stored 0 0% 12-18-2018 16:56 00000000 META-INF/maven/
...
0 Stored 0 0% 12-18-2018 16:56 00000000 com/
...
1123 Defl:N 451 60% 12-18-2018 16:56 eea5d81a log4j.properties
It ought to be something simple but before further digging into my setup details I want to make sure there isn't something special for tomcat. Something in ${catalina.base}/conf or conflicts with tomcat's logging system.
>On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" wrote:
>
>I have an old webapp that uses log4j 1.2 and which I am trying to deploy on tomcat. For the heck of it I can't get tomcat to use the log4.properties<http://log4.properties> file. What am I doing wrong?
>
>tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the app is working fine. The project is mavenized, I put log4.properties<http://log4.properties> to src/main/resources and it ends up in the jar file of my application. Is there anything special that needs to be done?
>
>________________________________
>
>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: log4j app logging
Posted by Ryan Palmer <ry...@hotmail.com>.
Michael,
The file needs to be named log4j.properties<http://log4j.properties> (or .xml, .json, etc.) and needs to be in the classpath. You ommitted the 'j'.
Sent from BlueMail<http://www.bluemail.me/r?b=14063>
On Dec 18, 2018, at 9:42 AM, "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>> wrote:
I have an old webapp that uses log4j 1.2 and which I am trying to deploy on tomcat. For the heck of it I can't get tomcat to use the log4.properties<http://log4.properties> file. What am I doing wrong?
tomcat 9.0.6 is installed as a Windows service and does serve my webapp, so the app is working fine. The project is mavenized, I put log4.properties<http://log4.properties> to src/main/resources and it ends up in the jar file of my application. Is there anything special that needs to be done?
________________________________
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: log4j app logging
Posted by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>.
On Thursday, December 27, 2018 5:35 PM, Mark H. Wood wrote:
>On Wed, Dec 19, 2018 at 06:52:20PM +0000, Lemke, Michael ST/HZA-ZIC2 wrote:
>> On December 19, 2018 6:54 PM Lemke, Michael wrote:
>> >On December 18, 2018 8:52 PM Christopher Schultz wrote:
>> >>On 12/18/18 12:42, Lemke, Michael ST/HZA-ZIC2 wrote:
>> >>> I have an old webapp that uses log4j 1.2 and which I am trying to
>> >>> deploy on tomcat. For the heck of it I can't get tomcat to use the
>> >>> log4.properties file. What am I doing wrong?
>> >>
>> >>
...
>> >I guess I have a terrible mess of all sorts of loggers in my libraries. I am
>> >not good at all the different Java loggers. The log4j.properties I want
>> >to use is for log4j-1.2.27 so not quite bleeding edge ??. Then there are
>> >other libs that pull in slf4j-api-1.7.25.jar, there is a jcl-over-slf4j-1.7.25.jar,
>> >logback-classic-1.2.3.jar, logback-core-1.2.3.jar.
>> >
>
>If this happens to be a project built with Maven then 'mvn
>dependency:tree' should tell you which artifacts are pulling in
>SLF4J. You may need to run this more than once as you comb out
>transitive dependencies one by one.
>
>But it's possible to use multiple logging frameworks in one webapp. if
>you include/exclude the right artifacts. See
>https://www.slf4j.org/legacy.html if you need to do this with SLF4J
>and Log4J v1.
Thank you very much, Mark, this was very helpful. With it I could clean up the mess.
Most important part was to get rid of logback-* and switch everything to slf4j
with the help of slf4j-log4j12. Now everything seems to be working.
Thanks again,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: log4j app logging
Posted by "Mark H. Wood" <mw...@iupui.edu>.
On Wed, Dec 19, 2018 at 06:52:20PM +0000, Lemke, Michael ST/HZA-ZIC2 wrote:
> On December 19, 2018 6:54 PM Lemke, Michael wrote:
> >On December 18, 2018 8:52 PM Christopher Schultz wrote:
> >>On 12/18/18 12:42, Lemke, Michael ST/HZA-ZIC2 wrote:
> >>> I have an old webapp that uses log4j 1.2 and which I am trying to
> >>> deploy on tomcat. For the heck of it I can't get tomcat to use the
> >>> log4.properties file. What am I doing wrong?
> >>
> >>
> >>How are you initializing log4j?
> >
> >Good question. I just dug a little and have to say I don't know. It
> >is a myfaces 1.1 application and I just realized jsf has logging built
> >in somehow. I can't find any explicit call to Logger.getLogger in the
> >code.
> >
> >I guess I have a terrible mess of all sorts of loggers in my libraries. I am
> >not good at all the different Java loggers. The log4j.properties I want
> >to use is for log4j-1.2.27 so not quite bleeding edge ??. Then there are
> >other libs that pull in slf4j-api-1.7.25.jar, there is a jcl-over-slf4j-1.7.25.jar,
> >logback-classic-1.2.3.jar, logback-core-1.2.3.jar.
> >
> >Well, I do get quite lot of logging from the app in the tomcat logfiles, so
> >something is working. But I don't know how to configure it.
> >
> >This used to work when I ran it on resin but I also changed quite a bit on
> >the code when I switched to tomcat. I'll try without all the new stuff.
>
> And this was it. The old version without the stuff that pulls in all the other
> log libraries it works. So tomcat is out of the loop. Sorry for the noise.
> (But if someone has a hint on my mess I wouldn't mind.)
If this happens to be a project built with Maven then 'mvn
dependency:tree' should tell you which artifacts are pulling in
SLF4J. You may need to run this more than once as you comb out
transitive dependencies one by one.
But it's possible to use multiple logging frameworks in one webapp. if
you include/exclude the right artifacts. See
https://www.slf4j.org/legacy.html if you need to do this with SLF4J
and Log4J v1.
--
Mark H. Wood
Lead Technology Analyst
University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
RE: log4j app logging
Posted by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>.
On December 19, 2018 6:54 PM Lemke, Michael wrote:
>On December 18, 2018 8:52 PM Christopher Schultz wrote:
>>On 12/18/18 12:42, Lemke, Michael ST/HZA-ZIC2 wrote:
>>> I have an old webapp that uses log4j 1.2 and which I am trying to
>>> deploy on tomcat. For the heck of it I can't get tomcat to use the
>>> log4.properties file. What am I doing wrong?
>>
>>
>>How are you initializing log4j?
>
>Good question. I just dug a little and have to say I don't know. It
>is a myfaces 1.1 application and I just realized jsf has logging built
>in somehow. I can't find any explicit call to Logger.getLogger in the
>code.
>
>I guess I have a terrible mess of all sorts of loggers in my libraries. I am
>not good at all the different Java loggers. The log4j.properties I want
>to use is for log4j-1.2.27 so not quite bleeding edge ??. Then there are
>other libs that pull in slf4j-api-1.7.25.jar, there is a jcl-over-slf4j-1.7.25.jar,
>logback-classic-1.2.3.jar, logback-core-1.2.3.jar.
>
>Well, I do get quite lot of logging from the app in the tomcat logfiles, so
>something is working. But I don't know how to configure it.
>
>This used to work when I ran it on resin but I also changed quite a bit on
>the code when I switched to tomcat. I'll try without all the new stuff.
And this was it. The old version without the stuff that pulls in all the other
log libraries it works. So tomcat is out of the loop. Sorry for the noise.
(But if someone has a hint on my mess I wouldn't mind.)
Thanks,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: log4j app logging
Posted by "Lemke, Michael ST/HZA-ZIC2" <le...@schaeffler.com>.
Christopher,
On December 18, 2018 8:52 PM Christopher Schultz wrote:
>On 12/18/18 12:42, Lemke, Michael ST/HZA-ZIC2 wrote:
>> I have an old webapp that uses log4j 1.2 and which I am trying to
>> deploy on tomcat. For the heck of it I can't get tomcat to use the
>> log4.properties file. What am I doing wrong?
>
>Are you trying to get Tomcat to use the log4j.properties file from
>your application?
No, this is not what I want to do.
>If so, that's not going to work, because Tomcagt
>starts up long before your application is loaded, and so the log4j.jar
>file and log4j.properties file are not used at all.
>
>Your *application* should be able to use log4j without any problems as
>long as the log4j.jar file is in WEB-INB/lib and your log4j.properties
>file is in (usually) WEB-INF/classes/log4j.properties.
Right, I want my application to use its log4j.properties.
>
>> tomcat 9.0.6 is installed as a Windows service and does serve my
>> webapp, so the app is working fine. The project is mavenized, I
>> put log4.properties to src/main/resources and it ends up in the jar
>> file of my application. Is there anything special that needs to be
>> done?
>
>How are you initializing log4j?
Good question. I just dug a little and have to say I don't know. It
is a myfaces 1.1 application and I just realized jsf has logging built
in somehow. I can't find any explicit call to Logger.getLogger in the
code.
I guess I have a terrible mess of all sorts of loggers in my libraries. I am
not good at all the different Java loggers. The log4j.properties I want
to use is for log4j-1.2.27 so not quite bleeding edge 😉. Then there are
other libs that pull in slf4j-api-1.7.25.jar, there is a jcl-over-slf4j-1.7.25.jar,
logback-classic-1.2.3.jar, logback-core-1.2.3.jar.
Well, I do get quite lot of logging from the app in the tomcat logfiles, so
something is working. But I don't know how to configure it.
This used to work when I ran it on resin but I also changed quite a bit on
the code when I switched to tomcat. I'll try without all the new stuff.
Thanks,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: log4j app logging
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Michael,
On 12/18/18 12:42, Lemke, Michael ST/HZA-ZIC2 wrote:
> I have an old webapp that uses log4j 1.2 and which I am trying to
> deploy on tomcat. For the heck of it I can't get tomcat to use the
> log4.properties file. What am I doing wrong?
Are you trying to get Tomcat to use the log4j.properties file from
your application? If so, that's not going to work, because Tomcagt
starts up long before your application is loaded, and so the log4j.jar
file and log4j.properties file are not used at all.
Your *application* should be able to use log4j without any problems as
long as the log4j.jar file is in WEB-INB/lib and your log4j.properties
file is in (usually) WEB-INF/classes/log4j.properties.
> tomcat 9.0.6 is installed as a Windows service and does serve my
> webapp, so the app is working fine. The project is mavenized, I
> put log4.properties to src/main/resources and it ends up in the jar
> file of my application. Is there anything special that needs to be
> done?
How are you initializing log4j?
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlwZT8kACgkQHPApP6U8
pFjhkxAAi2N30jbKuENmuYhCVq6mlN2N0r8BQcNBhS6fx36DqLQd8V4/BRMQ3Y7+
o/mD1iG+2oGyovocdjspYgFD98dPoL4crUkhrWdc+FUJU7+M64zs7pwfvEnEpdQo
XXp4H15XYOfUT3IyqWuuxoOuX7AHwKfGvUoKSapiGxCWWGsW8LUVcWpec+Ow+oKu
7jd6Tc7xPMqvWpMHKJ/MoamU0BaxpE774BJSz7QJKu7tb/flSykc08vUVxGPg/9X
tfqbiQ8RbzP8Y7UFdDmbySPhK/+VpbwU7ljx5/detNshxZZrEwjKSU3udS/A9bxi
pHkM3gPbtyN/L9VLwaAF1LlxqYolkOqJRuGrw9hRtU5ihydyd7C3Du7T6CpWLSRn
WQ2UTEVwSMJl2y+FF+nKs2o/svPaNNyiwdRq6A1VuEfZBTgb4pG2XDkggOtgqYX0
KuzYwtvKvPU/VWJsRYZkEtQ4yCiHUKiKoGz4AiZSHqxLQ4oSAetMx1SUtCTRllb9
bOHaMJkiTh+Iez1t1JRSQtYloW+z2i9w4H/CDwU6YDWOkmvp5URbEtIxUzpAcl3f
E4o9FHcYZKG8KUYobkeSNDD5mo19QDbRUbnLx0TzvtYCbzrg+Ol60yd+8A9lzAz7
6Rz6EePOYXCPjQD3i8OCpbTt1UCGQJB0M6nXr9qNBO5uoBQYMXw=
=uBKg
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org