Hi,
In the past 3 months, a few messages were posted that provide useful hints on
what is required to have log4j working properly.
1 ) Add the following lines at the beginning of tdk-2.3/bin/catalina.sh if you
are working with Linux :
CATALINA_OPTS=-Dorg.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
export CATALINA_OPTS
2 ) Add commons-logging-api.jar and log4j-1.2.8.jar to tdk-2.3/common/lib.
3 ) Customize your log4j properties according to your needs. The following
lines from Henning work. I have added applicationRoot definition.
# ------------------------------------------------------------------------
#
# Logging Configuration
#
# $Id: logging-service.xml,v 1.2 2003/01/12 14:54:56 henning Exp $
#
# ------------------------------------------------------------------------
applicationRoot = /home/loic/program/tdk-2.3/webapps/frame
#
# If we don't know the logging facility, put it into the
# turbine.log
#
log4j.rootLogger = INFO, turbine
#
# Turbine goes into Turbine Log
#
log4j.category.org.apache.turbine = DEBUG, turbine
log4j.additivity.org.apache.turbine = false
#
# Torque has its own log file
#
log4j.category.org.apache.torque = DEBUG, torque
log4j.additivity.org.apache.torque = false
#
# Velocity Logfile
#
log4j.category.velocity = DEBUG, velocity
log4j.additivity.velocity = false
#
# Scheduler Category
#
log4j.category.scheduler = DEBUG, scheduler
log4j.additivity.scheduler = false
#
# Commons goes into Turbine Log
#
log4j.category.org.apache.commons = INFO, turbine
log4j.additivity.org.apache.commons = false
########################################################################
#
# Logfile definitions
#
########################################################################
#
# turbine.log
#
log4j.appender.turbine = org.apache.log4j.FileAppender
log4j.appender.turbine.file = ${applicationRoot}/logs/turbine.log
log4j.appender.turbine.layout = org.apache.log4j.PatternLayout
log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.turbine.append = false
#
# torque.log
#
log4j.appender.torque = org.apache.log4j.FileAppender
log4j.appender.torque.file = ${applicationRoot}/logs/torque.log
log4j.appender.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.torque.append = false
#
# Scheduler Output
#
log4j.appender.scheduler = org.apache.log4j.FileAppender
log4j.appender.scheduler.file = ${applicationRoot}/logs/scheduler.log
log4j.appender.scheduler.layout = org.apache.log4j.PatternLayout
log4j.appender.scheduler.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.scheduler.append = false
#
# Velocity gets configured to write its output onto the velocity
# category.
#
log4j.appender.velocity = org.apache.log4j.FileAppender
log4j.appender.velocity.file = ${applicationRoot}/logs/velocity.log
log4j.appender.velocity.layout = org.apache.log4j.PatternLayout
log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.velocity.append = false
4 ) Notice that in TurbineResources.properties (.template), "L" is written
with uppercase while the filename is with lowercase. Either copy
log4j.properties to Log4j.properties or rename it in TurbineResources.*.
log4j.file = /WEB-INF/conf/Log4j.properties
The only problem that remains is for an org.apache.commons.digester.Digester.
I can't understand why the rootLogger definition doesn't apply, but this is
to my eyes a minor problem.
Lo�c
On Tuesday 02 December 2003 07:56 pm, Daniel wrote:
> LOL, I decided to humour the situation and you won't believe this but
> /logs/turbine.log actually means the C:\! Thanks David!
>
> That's a bit of a pain but I guess that's how log4j works, doesn't matter
> if it's in a webapp or not, a path is still a path relative to the "root"
> dir.
>
> Does anyone know of the top of their head if this can be changed so
> it logs to mywebapp/logs? Like in the old Turbine 2.1 way?
>
> On Tue, 2 Dec 2003, David Demner wrote:
> > Hi Daniel,
> >
> > The error message says the log file is supposed to be \logs\turbine.log;
> > maybe it's trying to create the log file in the root directory? Of
> > course, the question is which directory does it think is the root.
> >
> > Maybe try going up the directory tree starting in the location of the
> > log4j.properties file, creating logs directories, and seeing if the log
> > file gets created in any of these? Kind of a brute force method, but
> > maybe it will give some hints?
> >
> > David
> >
> > -----Original Message-----
> > From: Daniel [mailto:[EMAIL PROTECTED]
> > Sent: December 2, 2003 10:20 AM
> > To: Turbine Users List
> > Subject: RE: turbine 2.3 log4j errors
> >
> >
> >
> > Hi David, yep, under mywebapp/logs. I've also tried setting it to use
> > "../../logs/turbine.log" since somehow I thought maybe it's relative to
> > my Log4j.properties (name should be lower case right?) which is in
> > mywebapp/WEB-INF/conf.
> >
> > The only setting that doesn't cause the error is if I use just
> > "turbine.log" but that's not what I want. Maybe I'm missing something
> > for using log4j ... like what's the paths one should use for specifying
> > filenames/directories in log4j.properties, in the context of a
> > webapp? Is it relative to the webapp's dir or WEB-INF or? I'm still
> > reading up on the log4j docs. :(
> >
> > Thanks for your help!
> >
> > On Tue, 2 Dec 2003, David Demner wrote:
> > > Hi Daniel,
> > >
> > > This may be a dumb question, but does the logs directory exist?
> > >
> > > David
> > >
> > > -----Original Message-----
> > > From: Daniel [mailto:[EMAIL PROTECTED]
> > > Sent: December 2, 2003 8:12 AM
> > > To: Turbine Users List
> > > Subject: turbine 2.3 log4j errors
> > >
> > >
> > >
> > > Hi,
> > >
> > > I'm trying to port my app to Turbine 2.3 and for the most part things
> > > seem to be working (though I still need to clean up my TR.props a bit).
> > > However, upon starting Tomcat 4.1.29, I get a log4j error.
> > >
> > > I do have a properties file, the same settings as the one on the
> > > migration to 2.3 howto, under WEB-INF/conf/Log4j.properties which is
> > > indicated at the very bottom of the stack trace (also tried putting one
> > > in WEB-INF/classes).
> > >
> > > Anyone got any hints or ideas? Thanks.
> > >
> > >
> > > Dec 2, 2003 11:05:06 AM org.apache.coyote.http11.Http11Protocol init
> > > INFO: Initializing Coyote HTTP/1.1 on port 8080
> > > Starting service Tomcat-Standalone
> > > Apache Tomcat/4.1.29
> > > Dec 2, 2003 11:05:07 AM org.apache.struts.util.PropertyMessageResources
> > > <init>
> > > INFO: Initializing, config='org.apache.struts.util.LocalStrings',
> > > returnNull=tru
> > > e
> > > Dec 2, 2003 11:05:07 AM org.apache.struts.util.PropertyMessageResources
> > > <init>
> > > INFO: Initializing, config='org.apache.struts.action.ActionResources',
> > > returnNul
> > > l=true
> > > Dec 2, 2003 11:05:08 AM org.apache.struts.util.PropertyMessageResources
> > > <init>
> > > INFO: Initializing,
> > > config='org.apache.webapp.admin.ApplicationResources', retur
> > > nNull=true
> > > log4j:ERROR setFile(null,true) call failed.
> > > java.io.FileNotFoundException: \logs\turbine.log (The system cannot
> > > find the pat
> > > h specified)
> > > at java.io.FileOutputStream.openAppend(Native Method)
> > > at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
> > > at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
> > > at org.apache.log4j.FileAppender.setFile(FileAppender.java:272)
> > > at
> > > org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java
> > >
> > > :156)
> > >
> > > at
> > > org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151)
> > > at
> > > org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:2
> > > 47)
> > > at
> > > org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
> > > ava:123)
> > > at
> > > org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.j
> > > ava:87)
> > > at
> > > org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigura
> > > tor.java:645)
> > > at
> > > org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigura
> > > tor.java:603)
> > > at
> > > org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyC
> > > onfigurator.java:524)
> > > at
> > > org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurato
> > > r.java:408)
> > > at
> > > org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.
> > > java:340)
> > > at org.apache.turbine.Turbine.configure(Turbine.java:373)
> > > at org.apache.turbine.Turbine.init(Turbine.java:230)
> > > at javax.servlet.GenericServlet.init(GenericServlet.java:256)
> > > at
> > > org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
> > > java:935)
> > > at
> > > org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:82
> > > 3)
> > > at
> > > org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
> > > t.java:3422)
> > > at
> > > org.apache.catalina.core.StandardContext.start(StandardContext.java:3
> > > 623)
> > > at
> > > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
> > > .java:821)
> > > at
> > > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
> > > 7)
> > > at
> > > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
> > >
> > > at
> > > org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
> > > loyer.java:307)
> > > at
> > > org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
> > > at
> > > org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:492
> > > )
> > > at
> > > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400
> > > )
> > > at
> > > org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
> > > at
> > > org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
> > >
> > > :358)
> > >
> > > at
> > > org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
> > > eSupport.java:166)
> > > at
> > > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
> > >
> > > at
> > > org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
> > > at
> > > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
> > >
> > > at
> > > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363
> > > )
> > > at
> > > org.apache.catalina.core.StandardService.start(StandardService.java:4
> > > 97)
> > > at
> > > org.apache.catalina.core.StandardServer.start(StandardServer.java:219
> > > 0)
> > > at
> > > org.apache.catalina.startup.Catalina.start(Catalina.java:512) at
> > > org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at
> > > org.apache.catalina.startup.Catalina.process(Catalina.java:180) at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> > > java:39)
> > > at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > > sorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:324)
> > > at
> > > org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) 0 [main]
> > > INFO turbine.Turbine - Configured log4j from
> > > C:\Java\Software\jakarta-
> > > tomcat-4.1.29\webapps\skeleton\WEB-INF\conf\Log4j.properties
> > > 15 [main] INFO turbine.Turbine - Loaded configuration (Properties)
> > > from /WEB-I
> > > NF/conf/TurbineResources.properties
> > > (C:\Java\Software\jakarta-tomcat-4.1.29\weba
> > > pps\skeleton\WEB-INF\conf\TurbineResources.properties)
> > >
> > >
> > > Regards,
> > > Daniel
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Cordialement,
Lo�c QUERAN
GICM
32 Rue Mirabeau 29 480 LE RELECQ KERHUON
T�l�phone : 02.98.00.23.39
Mobile : 06.74.40.59.37
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]