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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to