a) Where does the log4j.properties file for your webapp reside ?
b) Do you have a log4j.jar in WEB-INF/lib/ ?

M.

On Mon, Jul 27, 2009 at 4:45 PM, pieter claassen
<pieter.claas...@gmail.com>wrote:

> I am sure something is broken in tomcat. This is not a dependency issue as
> the build runs file and manually logging info with log4j also works (see
> below). The problem seems when wicket logs using slf4j and this only goes
> to
> catalina.log (I cannot get this redirected to my own log file).
>
> If I understand this correctly, wicket uses slf4j to log its own internals.
> With tomcat6, I am supposed to then configure log4j (or any adapter that I
> want to) to get that information to the location I would like to (a local
> text log file).
>
> I am trying to enable wicket's requestlog debugging and directing the
> output
> to my application log file for later inspection.
>
> If I run the following code, I get a message in catalina.out (I also get
> all
> the debug information from wicket requestlogger on catalina.out)
>
> Logger logger=LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
> logger.info("AUTH PAGE ACCESSED");
>
> When I run the code under a debugger, I can see that logger points to
> catalina.out, so clearly I failed to point rootLogger to another file with
> either of my log4j.properties settings.
>
> Note however, that if I use org.apache.log4j.Logger then I can correctly
> dump logging infor to my target file
>
> Logger.getRootLogger().info("AUTHPAGE Logged with Logger.getRootLogger()");
>
> Here is my question:
>
> 1. What is the correct procedure to enable request logging with wicket and
> tomcat so that each of my applications dumps its request data to a specific
> text file?
>
> Thanks for all the feedback so far.
> Pieter
>
>
> here is my log4j.properties in my tomcat lib directory
>
> log4j.rootLogger=INFO, R
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=${catalina.home}/logs/tomcat.log
> log4j.appender.R.MaxFileSize=10MB
> log4j.appender.R.MaxBackupIndex=10
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
> log4j.logger.org.apache.catalina=INFO, R
>
> log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO,
> R
> log4j.logger.org.apache.catalina.core=INFO, R
> log4j.logger.org.apache.catalina.session=INFO, R
>
> Here is my application log4j.properties file.
>
> log4j.rootLogger=INFO,R
> log4j.category.org.apache.wicket.protocol.http.RequestLogger=INFO
> log4j.logger.org.apache.wicket=INFO
> log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
> log4j.logger.org.apache.wicket.version=INFO
> log4j.logger.org.apache.wicket.RequestCycle=INFO
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/var/log/${application.name}/application.log
> log4j.appender.R.MaxFileSize=10MB
> log4j.appender.R.MaxBackupIndex=10
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - log file%m%n
>
>
>
> On Mon, Jul 27, 2009 at 12:00 PM, Maarten Bosteels
> <mbosteels....@gmail.com>wrote:
>
> > On Fri, Jul 24, 2009 at 3:47 PM, pieter claassen <pie...@claassen.co.uk
> > >wrote:
> >
> > > I think that slf4j is not working in my setup and it might have nothing
> > to
> > > do with Tomcat. As a matter of fact, I assume I don't even have to have
> > > log4j or slf4j working with tomcat, but that as long as my POM
> references
> > > the correct dependencies, my application should log correctly?
> > >
> > > To overcome the following error, I had to upgrade by slf4j and log4j
> deps
> > > to
> > > the latest version.
> > >
> > > Caused by: java.lang.IllegalAccessError: tried to access field
> > > org.slf4j.impl.StaticLoggerBinder.SINGLETON from class
> > > org.slf4j.LoggerFactory
> > >
> > > These are my maven deps.
> > >
> > >        <dependency>
> > >            <groupId>org.slf4j</groupId>
> > >            <artifactId>slf4j-log4j12</artifactId>
> > >            <version>1.5.6</version>
> > >        </dependency>
> > >        <dependency>
> > >            <groupId>org.slf4j</groupId>
> > >            <artifactId>slf4j-api</artifactId>
> > >            <version>1.5.6</version>
> > >        </dependency>
> >
> >
> > You still need log4j itself.  add this dependency:
> >
> >    <dependency>
> >        <groupId>log4j</groupId>
> >        <artifactId>log4j</artifactId>
> >        <version>1.2.14</version>
> >      </dependency>
> >
> > Maarten
> >
> >
> > >
> > >
> > > I see the same behaviour in Glassfish and tomcat. Does anybody have
> > > slf4j-1.5.6 working with log4j-1.2.14?
> > >
> > > I am stumped?!
> > > P
> > >
> > >
> > > On Fri, Jul 24, 2009 at 9:22 AM, pieter claassen <
> pie...@claassen.co.uk
> > > >wrote:
> > >
> > > > I am trying to get my application to log to a separate file with the
> > > > following log4j.properties (server is tomcat6 in netbeans). I enabled
> > the
> > > > following in my wicketapplication.
> > > >
> > > > getRequestLoggerSettings().setRequestLoggerEnabled(true);
> > > >
> > > > What I find is that catalina.{date}.out logs the requests correctly,
> > but
> > > I
> > > > get tomcat startup info in my logfile and then nothing else.
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks,
> > > > Pieter
> > > >
> > > > /var/log/webapp/application.log
> > > > ========================
> > > >
> > > > 2009-07-24 09:21:28,052 INFO  - ContextLoader              - Root
> > > > WebApplicationContext: initialization started
> > > > 2009-07-24 09:21:28,082 INFO  - XmlWebApplicationContext   -
> Refreshing
> > > >
> > org.springframework.web.context.support.xmlwebapplicationcont...@1077092
> > > :
> > > > display name [Root WebApplicationContext]; startup date [Fri Jul 24
> > > 09:21:28
> > > > CEST 2009]; root of context hierarchy
> > > > 2009-07-24 09:21:28,134 INFO  - XmlBeanDefinitionReader    - Loading
> > XML
> > > > bean definitions from ServletContext resource
> > > > [/WEB-INF/WicketApplicationDefinition.xml]
> > > > 2009-07-24 09:21:28,555 INFO  - XmlWebApplicationContext   - Bean
> > factory
> > > > for application context
> > > >
> > [org.springframework.web.context.support.xmlwebapplicationcont...@1077092
> > > ]:
> > > >
> > >
> >
> org.springframework.beans.factory.support.defaultlistablebeanfact...@1ab5e0b
> > > > 2009-07-24 09:21:28,582 INFO  - DefaultListableBeanFactory -
> > > > Pre-instantiating singletons in
> > > >
> > >
> >
> org.springframework.beans.factory.support.defaultlistablebeanfact...@1ab5e0b
> > > :
> > > > defining beans [myDataSource,appConfig,WicketApplication]; root of
> > > factory
> > > > hierarchy
> > > > 2009-07-24 09:21:29,172 INFO  - ContextLoader              - Root
> > > > WebApplicationContext: initialization completed in 1120 ms
> > > >
> > > >
> > > > log4j.properties
> > > > ==============
> > > > log4j.rootLogger=INFO, file
> > > >
> > > > log4j.appender.file=org.apache.log4j.RollingFileAppender
> > > > log4j.appender.file.maxFileSize=100KB
> > > > log4j.appender.file.maxBackupIndex=5
> > > > log4j.appender.file.File=/var/log/${application.name
> }/application.log
> > > > log4j.appender.file.layout=org.apache.log4j.PatternLayout
> > > > log4j.appender.file.layout.ConversionPattern=%d %-5p - %-26.26c{1} -
> > %m\n
> > > >
> > > >
> > > > log4j.catagory.org.apache.wicket.protocol.http.RequestLogger=INFO
> > > > log4j.logger.org.apache.wicket=INFO
> > > > log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
> > > > log4j.logger.org.apache.wicket.version=INFO
> > > > log4j.logger.org.apache.wicket.RequestCycle=INFO
> > > >
> > > > --
> > > > Pieter Claassen
> > > >
> > > >
> > >
> > >
> > > --
> > > Pieter Claassen
> > > musmato.com
> > >
> >
>
>
>
> --
> Pieter Claassen
> musmato.com
>

Reply via email to