Yes, I find that if I use log4j directly, then it works, but if I use slf4j,
then it logs via the built in java.util.logging of tomcat6. So the issue
seems to be to integrate slf4j with Tomcat6. There seems to be little out
there on how to replace commons logging with slf4j rather than log4j (so it
is either *very* easy or *very* hard)
This prints to the tomcat console but not to my log anymore.
Logger logger=LoggerFactory.getLogger(AuthPage.class);
logger.info("AUTH PAGE ACCESSED");
P
On Fri, Jul 24, 2009 at 2:13 PM, McIlwee, Craig <
[email protected]> wrote:
> I doubt this is a wicket problem, I can redirect all logging for each of my
> wars to their own file with no trouble.
>
> First, what slf4j implementation are you using?
>
> Second, have a look at this page:
> http://www.jboss.org/community/wiki/Log4jRepositorySelector. I know that
> its for JBoss, but I image it should work for you also since JBoss is built
> on top of tomcat. In JBoss 4.2.3 and lower I was able to use log4j sandbox
> alpha 3, which had a similar implementation of the repository selector that
> could work based on JNDI context or context classloader. Good luck finding
> that jar though, it's damn near impossible, you may have to download from
> apache's SVN and build it yourself. In JBoss 5+ the deployment structure
> changed and I now have to use a customized version of the class at the link
> above, works just fine.
>
> Craig
> Open Roads Consulting, Inc.
> 757-546-3401
> http://www.openroadsconsulting.com
> _____
>
> From: pieter claassen [mailto:[email protected]]
> To: [email protected]
> Sent: Fri, 24 Jul 2009 05:04:03 -0400
> Subject: Re: log4j question with wicket
>
> There seems to be something broken in wicket here.
>
> Logger.getRootLogger().info("AUTHPAGE REQUESTED");
>
> This does log to my log file, but for some reason the following code still
> just logs to the console in tomcat. I have converted tomcat to use log4j
> and
> can print tomcat debug into to a file.
>
> log4j.category.org.apache.wicket.protocol.http.RequestLogger=INFO
>
> Any ideas?
>
> Thanks,
> Pieter
>
> On Fri, Jul 24, 2009 at 9:22 AM, pieter claassen <[email protected]
> >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