Idea 5.1, tomcat 5.5 and log4j logging

I got a following problem: (IDEA 5.1, tomcat 5.5, simple web application) With default tomcat logging and tomcat/local configuration in IDEA everything works fine.

But - as soon as I change tomcat's logging to log4j (console and file appenders) - when I try to start the application IDEA "does not understand" that tomcat is started. I.e: no "connected to server" message in IDEA's console (and no browser window is open, as configured in IDEA for an app. start), just tomcat's console output (which shows that tomcat is started corectly).

And, what even worse, when I try to run the application - IDEA just dumbly runs it over again and displays "port 8080 is occupied" message. While before it correctly offered to reload the app in (already running) tomcat.

This is very frustrating. Can anyone help/give any advice?

Thank you.

3 comments
Comment actions Permalink

If I remember correctly (haven't got tomcat installed at my current location) IDEA listens on the output/console for the 'started' message. Maybe check to see if there are any differences when you use log4j.

0
Comment actions Permalink

Ruben Boer wrote:

If I remember correctly (haven't got tomcat installed at my current
location) IDEA listens on the output/console for the 'started'
message.


Specifically (for Tomcat 5.0 or later), the Tomcat plug-in looks for a
line ending with "org.apache.jk.server.JkMain start".

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Yes, thanks, that helped.

If anyone else encounters this problem: your log4j pattern for PatternLayout should end with "%c %M%n", otherwise IDEA won't recognize that tomcat is started. Example:

log4j.appender.stdout.layout.ConversionPattern=%p: %m - %c %M%n

Note: never use %M (Method name) in production env, if you got active logging. Method name generation is slow.

0

Please sign in to leave a comment.