> Anyone used log4j with Spring 1.2? If I'm not mistaken, Spring 1.1 used
> log4j and now 1.2 uses commons logging. Does anyone know how to make
> log4j work with the newer version of Spring
Are you trying to simply debug spring with log4j, or are you trying to
log as an aspect? I do the former using spring 1.2 without any
problems. Commons logging uses a log4j config if it finds one.
Place a file similair to this in your WEB-INF/classes dir called
'log4j.properties', along with commons logging and log4j in your
WEB-INF/lib, and you should see files like apache_logs.log in your
tomcat/logs dir:
##################INICIO DOS APPENDERs################################
# console1 será um appender de console que exibirá somente a mensagem
log4j.appender.console1=org.apache.log4j.ConsoleAppender
log4j.appender.console1.layout=org.apache.log4j.PatternLayout
log4j.appender.console1.layout.ConversionPattern=%m
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# console2 será um appender de console que exibirá todas as
propriedades
log4j.appender.console2=org.apache.log4j.ConsoleAppender
log4j.appender.console2.layout=org.apache.log4j.PatternLayout
log4j.appender.console2.layout.ConversionPattern=%d [%c] - %m%n
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# apacheOrg é um appender de arquivo para as classes da apache.org
log4j.appender.apacheOrg=org.apache.log4j.RollingFileAppender
log4j.appender.apacheOrg.layout=org.apache.log4j.PatternLayout
log4j.appender.apacheOrg.layout.ConversionPattern=%d [%c] - %m%n
log4j.appender.apacheOrg.File=${catalina.home}/logs/apache_logs.log
log4j.appender.apacheOrg.MaxFileSize=40000KB
log4j.appender.apacheOrg.MaxBackupIndex=1
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# appErros é um appender de arquivo para os logs de erro do Sistema
log4j.appender.appErros=org.apache.log4j.RollingFileAppender
log4j.appender.appErros.layout=org.apache.log4j.PatternLayout
log4j.appender.appErros.layout.ConversionPattern=%m
log4j.appender.appErros.File=app_erros.log
log4j.appender.appErros.MaxFileSize=400KB
log4j.appender.appErros.MaxBackupIndex=1
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# appDebug é um appender de arquivo para os logs de debug do Sistema
log4j.appender.appDebug=org.apache.log4j.RollingFileAppender
log4j.appender.appDebug.layout=org.apache.log4j.PatternLayout
#log4j.appender.appDebug.layout.ConversionPattern=%-4r %-5p %c %x -
%m%n
log4j.appender.appDebug.layout.ConversionPattern=%d [%c] - %m%n
log4j.appender.appDebug.File=${catalina.home}/logs/app_debug.log
log4j.appender.appDebug.MaxFileSize=40000KB
log4j.appender.appDebug.MaxBackupIndex=1
##################FIM DOS APPENDERs##################################
#################INICIO DO ROOTlOGGER################################
log4j.rootLogger=DEBUG, console2
###################FIM DO ROOTlOGGER################################
#############INICIO DAS DECLARAÇÕES DE CATEGORIAS####################
log4j.category.org.springframework=DEBUG, console2, apacheOrg
log4j.category.org.hibernate=DEBUG, console2, apacheOrg
log4j.category.net.sf.acegisecurity=WARN, console2, apacheOrg
log4j.category.com.siemens=DEBUG, console2, appDebug
log4j.category.org.apache=WARN, console2, apacheOrg
################FIM DAS DECLARAÇÕES DE CATEGORIAS####################
Scott Smith - 24 Nov 2005 17:18 GMT
On Thu, 24 Nov 2005 05:17:17 -0800, iksrazal wrote:
>> Anyone used log4j with Spring 1.2? If I'm not mistaken, Spring 1.1 used
>> log4j and now 1.2 uses commons logging. Does anyone know how to make
[quoted text clipped - 86 lines]
>
> ################FIM DAS DECLARAÇÕES DE CATEGORIAS####################
Yes, this stuff is set up fine. Thanks for the quick response. I
think you've implicitly answered my question. There seems to be a
dependency on org.apache.commons.logging.LogFactory. Here's the
initial portion of the error message:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
I'm assuming there is no way to use the Spring 1.2 without also including
this jar file as well in the classpath. I was hoping there was a way to
get Spring to be dependent on only one logging system, that is log4j. I
was trying to avoid the use of org.apache.commons.logging.LogFactory
altogether. I guess this is not possible. Anyone who knows otherwise,
please let me know.
Happy Thanksgiving!

Signature
R. Scott Smith
Slackware on the job, at home, everywhere!