Add two files to your WEB-INF/classes directory:

commons-logging.properties <==============================
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory

log4j.properties <=======================================
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG,A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

That should fix things, I believe. The commons-logging package is going to expect that you want to use Log4J if you have the Log4J JAR in the classpath (ie your WEB-INF/lib directory). It's not going to "work" correctly until you configure it properly though (at least, it never has for me).

Good Luck!

Paul Hodgetts, Agile Logic wrote:

Using the latest nightly build from 2002-12-27, the latest
Commons Logging nightly build from 2002-12-27, and Log4J
1.2.7...

I have Common Logging configured to use the SimpleLog, and
everything is working fine, with both my application and
Struts successfully logging to the simple log.

When I just drop log4j-1.2.7.jar into WEB-INF/lib,
regardless of whether I configure Commons Logging to use
the Log4JCategoryLog or not, I get this exception:

java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.java:140)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:255)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390)
at org.apache.struts.action.ActionServlet.<clinit>(ActionServlet.java:372)
[...]

I've been trying to follow the set up shown in Cavaness'
Programming Jakarta Struts book, chapter 15. What am I
doing wrong?

Thanks,
Paul
--
Eddie Bush




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to