one more day is over @ ceylan's office

Coding, not a profession but a joy…

Archive for the ‘maven’ Category

Logging with Log4J When Using maven-tomcat-plugin

with one comment

As you are reading this post, probably

  • You do web application development
  • You use maven as your your build system
  • You like to debug your application right from eclipse (preferably  also using Maven Eclipse Integration )

But,

  • you HATE the standard java logging and anything else – commons-logging, log4j, slf4j – will do it for you.

Here’s what you should do…

<build>
...
<plugins>
...
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0-beta-1-hc</version>
    <configuration>
      <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>
...
  </plugins>
...
</build>

Now, there needs to be done couple of things

  • juli-6.0.26-log4j is not published by tomcat project. you need to obtain tomcat juli log4j and install / deploy it to your local / company repository.
  • maven-tomcat-plugin has a bug that it sets the systemproperties just too late. you should either build and deploy an interim version of the plugin or check it out from the trunk and stick to the SNAPSHOT version until the plugin releases a new version.

For the second issue I emailed the author of the plugin, Olivier Lamy and asked about a planned release date, as I get an answer, I will publish the date here.

As a separate thing, the plugin has another bug that exposes itself if the application must run as ROOT application in tomcat and either the application or the framework(s) it is based on (struts, urlrewriter, etc) uses server side redirects (internal dispatching). TYhe bug is discussed  here and also the fix for that got main stream.
Enjoy…

Popularity: 84%

Written by Hasan Ceylan

May 3rd, 2010 at 8:47 am

Posted in bugs, eclipse, maven, solved

Tagged with , , , , ,

I’ll be back with a lot of things

without comments

Hello,

I have meant to get back to my blog for a long time. Believe me, I was really busy with really cool stuff.

I had been preoccupied with a great project. A SOA centric application that I was managing as the head of the development and it is *almost* there now.

It has all the great features one can expect from a web 2.0 application. This project has gotten there with the help of sub projects from eclipse ecosystem and maven off course…

So my next assignment on my blog will be the excerpts from my experiences during the development of this project which makes uses the bleeding edge technoligies like Eclipse RAP, Eclipse Teneo, Eclipse EMF, Eclipse Databinding etc. Well, EMF and databinding had been already been out there, but with the latest releases they got a great way of getting on well with the other kid on the block, Eclipse RCP +JFace…

See you on the next posting on Eclipse RAP….

Popularity: 1%

Written by Hasan Ceylan

November 14th, 2009 at 10:41 pm

Maven & Sun Jars

without comments

Various Sun jars are not published on standard maven repositories due to different licensing models. And What I ave been doing to download the jar and import the required jars to private hosted repository.

I mean until today. There seems to a java.net repository that I was missing for time…

What you should do include

      <repositories>
        <repository>
          <id>maven2-repository.dev.java.net</id>
          <name>Java.net Repository for Maven</name>
          <url>http://download.java.net/maven/2/</url>
          <layout>default</layout>
        </repository>
      </repositories>

in you settings.xml

So one more annoyance has been reolved for me…

The original information is provided on maven’s official website

Popularity: 1%

Written by Hasan Ceylan

August 20th, 2008 at 12:01 am