Child pages
  • Using the commons logger
Skip to end of metadata
Go to start of metadata
  1. Adding the commons-logger dependency to your project.xml
    1. Add the following to the dependencies block of your project.xml file to include the commons-logger:
      <dependency>
      	<groupId>commons-logging</groupId>
      	<artifactId>commons-logging</artifactId>
      	<version>1.0.4</version>
      </dependency>
      
      • The commons logger is included in shared/lib by Sakai itself so you do not need to package it in your tool war file (hence there is no <war.bundle>true</war.bundle>)
      • Version 1.0.4 was the current version when this was written
  2. Adding the logger to your code
    1. Add the following line just below your class line:
      private static Log log = LogFactory.getLog(MyClass.class);
      
      • Make sure your class name is listed in place of MyClass
    2. The commons logger requires 2 imports (eclipse will insert these for you):
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      
  • No labels