EduGarage Logo
Search:
Site Map
Upcoming Events:
Please e-mail us if you would like your webinar, conference, or get-together to be featured in this space.
Stay Informed:

log4j in a block

rated by 0 users
This post has 1 Reply | 0 Followers

Top 75 Contributor
Posts 2
ayoung Posted: 1 Oct 2009 12:00 AM
Is it possible to use log4j in a building block? I'm getting this error on block startup:

org.apache.commons.logging.LogConfigurationException: java.lang.NoClassDefFoundError (Caused by java.lang.NoClassDefFoundError)

Caused by: java.lang.NoClassDefFoundError
at org.apache.log4j.Logger.getLogger(Logger.java:104)

which I think is related to my block using its class name in Logger.getLogger(). I'm including commons-logging and log4j in the block's WEB-INF/lib

thanks.
Top 25 Contributor
Posts 10

Hi,

What version? they are changing it with every new release...

-----------------------------------

...

import org.apache.log4j.Logger;
...

public class YourClass {

  private static Logger logger = Logger.getLogger(YourClass.class);

   public YouClass {
      logger.debug("Entering constructor...");

...

 }

-----------------------------------

In version 7 (if I am not mistaken - it was a few years ago) - you need to include log4j.jar into Tomact class path and you have to initialize it in your building block (I did it in a servlet)

In version 8 - do not include log4j.jar in your building block war file and do not initialize it, the log4j properties file is in  /usr/local/blackboard/apps/tomcat/common/classes

in version 9 - I am still struggling to make it work... they change the directory of the properties file - now it is in /usr/local/blackboard/config/tomcat/classes

Hope this helps,

-D

 

 

 

Page 1 of 1 (2 items) | RSS
© 2006-2009 Blackboard Inc. All Rights Reserved. Blackboard, the Blackboard logo, and EduGarage are trademarks
or registered trademarks of Blackboard Inc. in the United States and/or other countries.