Maven 2.x Tomcat Plugin

System Properties set too late for logging alteration

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Duplicate
  • Affects Version/s: 1.0-beta-1
  • Fix Version/s: 1.0
  • Component/s: None
  • Labels:
    None
  • Environment:
    any
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

As I hate the juli logging that tomcat developers insist on using, I replace the logger to log4j as per tomcat documentation as soon as I install new one.

But maven tomcat plugin uses embedded tomcat which still makes it possible to force log4j over juli. Except a change is needed in the source.

According to the discussion here [1] System.properties should be set as soon as possible preferable before loading any tomcat class to prevent being too late for logger initialization. Therefore the attached patch is needed which merely move setupSystemProperties up before any tomcat class construction.

Also a tweak in the plugin configuration is needed as below:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<path>/</path>
<systemProperties>
<java.util.logging.manager>org.apache.juli.ClassLoaderLogManager</java.util.logging.manager>
<log4j.configuration>file://${basedir}/src/main/webapp/WEB-INF/log4j.xml</log4j.configuration>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>juli</artifactId>
<classifier>log4j</classifier>
<version>6.0.26</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>juli-adapters</artifactId>
<version>6.0.26</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
</dependency>
</dependencies>
</plugin>

regards,
Hasan Ceylan

Issue Links

Activity

Hide
Olivier Lamy added a comment -

linked to MTOMCAT-37 ?
Have you tried with current trunk ?

Show
Olivier Lamy added a comment - linked to MTOMCAT-37 ? Have you tried with current trunk ?
Hide
Hasan Ceylan added a comment -

Nope...

If it is fixed in trunk, it is fixed in trunk... Obviously this one is not a big deal...

Show
Hasan Ceylan added a comment - Nope... If it is fixed in trunk, it is fixed in trunk... Obviously this one is not a big deal...

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: