If somebody could help me setup log4J for Spring properly in WebSphere, I would be grateful. I've been able to get log4J setup properly so that *my* code uses it, but I can't seem to control the amount of logging that Spring itself does. It appears to me that Spring is hooking into the standard WebSphere logging and so I don't know how to change the logging levels. Am I missing something really basic?
I want to see some Spring/Acegi debugging output. Here's my log4j properties file:
Code:log4j.rootLogger=DEBUG, stdout log4j.logger.org.springframework=DEBUG log4j.logger.org.acegisecurity=DEBUG log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
Here's some console output. My own code has a couple of logging messages at the bottom of this; you can see that the logging format is different. You can also see that log4J is getting initialized properly from log4j.properties.
Here's my web.xml:Code:[4/4/06 13:01:40:424 EDT] 00000020 ApplicationMg A WSVR0200I: Starting application: SpringSample2.0EAR [4/4/06 13:01:40:611 EDT] 00000020 WebGroup A SRVE0169I: Loading Web Module: SpringSample2.0c. [4/4/06 13:01:40:814 EDT] 00000020 ContextLoader I Root WebApplicationContext: initialization started [4/4/06 13:01:40:814 EDT] 00000020 WebApp A SRVE0180I: [SpringSample2.0c] [/SpringSample2.0c] [Servlet.LOG]: Loading Spring root WebApplicationContext [4/4/06 13:01:41:017 EDT] 00000020 XmlBeanDefini I Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] ... [4/4/06 13:01:42:158 EDT] 00000020 ContextLoader I Root WebApplicationContext: initialization completed in 1344 ms [4/4/06 13:01:42:174 EDT] 00000020 WebApp A SRVE0180I: [SpringSample2.0c] [/SpringSample2.0c] [Servlet.LOG]: Set web app root system property: 'sample2.0c' = [C:\WebSphere\WorkSpace\normal.v6.0\SpringSample2.0c\WebContent] [4/4/06 13:01:42:220 EDT] 00000020 WebApp A SRVE0180I: [SpringSample2.0c] [/SpringSample2.0c] [Servlet.LOG]: Initializing Log4J from [C:\WebSphere\WorkSpace\normal.v6.0\SpringSample2.0c\WebContent\WEB-INF\log4j.properties] [4/4/06 13:01:42:564 EDT] 00000020 DispatcherSer I Initializing servlet 'example' [4/4/06 13:01:42:627 EDT] 00000020 DispatcherSer I FrameworkServlet 'example': initialization started [4/4/06 13:01:42:627 EDT] 00000020 WebApp A SRVE0180I: [SpringSample2.0c] [/SpringSample2.0c] [Servlet.LOG]: Loading WebApplicationContext for Spring FrameworkServlet 'example' [4/4/06 13:01:42:642 EDT] 00000020 XmlBeanDefini I Loading XML bean definitions from ServletContext resource [/WEB-INF/example-servlet.xml] [4/4/06 13:01:42:955 EDT] 00000020 XmlWebApplica I Bean factory for application context [WebApplicationContext for namespace 'example-servlet']: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [testMultiActionController,testMethodNameResolver,menuController,exceptionController,messageController,fileUploadController,viewResolver,messageSource,localeResolver,localeChangeInterceptor,multipartResolver,exceptionResolver,urlMapping]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [filterChainProxy,channelProcessingFilter,channelDecisionManager,secureChannelProcessor,insecureChannelProcessor,httpSessionContextIntegrationFilter,authenticationProcessingFilter,httpRequestAccessDecisionManager,roleVoter,authenticationDao,authenticationManager,daoAuthenticationProvider,filterInvocationInterceptor,exceptionTranslationFilter,authenticationProcessingFilterEntryPoint,rememberMeProcessingFilter,rememberMeServices,rememberMeAuthenticationProvider,anonymousProcessingFilter,anonymousAuthenticationProvider,switchUserProcessingFilter,concurrentSessionController,concurrentSessionFilter,sessionRegistry]; root of BeanFactory hierarchy ... [4/4/06 13:01:43:439 EDT] 00000020 DispatcherSer I No HandlerAdapters found in servlet 'example': using default [4/4/06 13:01:43:470 EDT] 00000020 DispatcherSer I Unable to locate RequestToViewNameTranslator with name 'viewNameTranslator': using default [org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator@2df20b6c] [4/4/06 13:01:43:470 EDT] 00000020 DispatcherSer I FrameworkServlet 'example': initialization completed in 859 ms [4/4/06 13:01:43:486 EDT] 00000020 DispatcherSer I Servlet 'example' configured successfully [4/4/06 13:01:43:486 EDT] 00000020 ServletWrappe A SRVE0242I: [example]: Initialization successful. [4/4/06 13:01:43:486 EDT] 00000020 VirtualHost I SRVE0250I: Web Module SpringSample2.0c has been bound to default_host[*:80,*:443]. [4/4/06 13:01:43:517 EDT] 00000020 ApplicationMg A WSVR0221I: Application started: SpringSample2.0EAR [4/4/06 13:02:31:158 EDT] 00000040 ServletWrappe A SRVE0242I: [/log.jsp]: Initialization successful. [4/4/06 13:02:31:236 EDT] 00000040 SystemOut O 2006-04-04 13:02:31,236 DEBUG [com.ibm._jsp._log] - This is a LOG4J debug statement [4/4/06 13:02:31:236 EDT] 00000040 SystemOut O 2006-04-04 13:02:31,236 WARN [com.ibm._jsp._log] - This is a LOG4J warn statement
Code:<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name> SpringSample2.0c</display-name> <!-- - Key of the system property that should specify the root directory of this - web app. Applied by WebAppRootListener or Log4jConfigListener. --> <context-param> <param-name>webAppRootKey</param-name> <param-value>sample2.0c</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <context-param> <description> </description> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <filter> <description> </description> <display-name> Acegi Filter Chain Proxy</display-name> <filter-name>Acegi Filter Chain Proxy</filter-name> <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class> <init-param> <description> </description> <param-name>targetBean</param-name> <param-value>filterChainProxy</param-value> </init-param> </filter> <filter-mapping> <filter-name>Acegi Filter Chain Proxy</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <description> </description> <display-name> Spring Application Context Loader</display-name> <listener-class>org.springframework.web.context.scope.RequestContextListener</listener-class> </listener> <listener> <description> </description> <display-name> ContextLoaderListener</display-name> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <listener> <description> Used by Acegi ConcurrentSessionFilter</description> <display-name> HttpSessionEventPublisher</display-name> <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class> </listener> <servlet> <description> </description> <display-name> example</display-name> <servlet-name>example</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>example</servlet-name> <url-pattern>/example/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>


Reply With Quote
