Yes, Spring logging of the framework is very detailed, you did not mention in your message if you are already using the registration framework or not. If you use log4j, just add Spring appenders to the log4j configuration (e.g. in log4j.xml or log4j.properties). If you use log4j xml config, you can do something like this
<category name="org.springframework.beans"> <priority value="debug" /> </category>
or
<category name="org.springframework"> <priority value="debug" /> </category>
I would advise you to test this problem in isolation using the JUnit test, you can do this using the spring testing module in conjunction with Junit . If you use the Spring test module, it will do the bulk of the work for you, it downloads the context file based on the configuration of your context and starts the container, so you can just focus on testing your business logic. I have a small example here
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:springContext.xml"}) @Transactional public class SpringDAOTest { @Autowired private SpringDAO dao; @Autowired private ApplicationContext appContext; @Test public void checkConfig() { AnySpringBean bean = appContext.getBean(AnySpringBean.class); Assert.assertNotNull(bean); } }
UPDATE
I do not advise you to change the way the log is loaded, but try this in your development environment, add this fragment to the web.xml
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>
UPDATE lo4j configuration file
I tested this on my local tomcat and it caused a lot of logging when the application started. I also want to use the debug non info fix, as @Rayan Stewart mentioned.
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> <param name="Threshold" value="debug" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{HH:mm:ss} %p [%t]:%c{3}.%M()%L - %m%n" /> </layout> </appender> <appender name="springAppender" class="org.apache.log4j.RollingFileAppender"> <param name="file" value="C:/tomcatLogs/webApp/spring-details.log" /> <param name="append" value="true" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{MM/dd/yyyy HH:mm:ss} [%t]:%c{5}.%M()%L %m%n" /> </layout> </appender> <category name="org.springframework"> <priority value="debug" /> </category> <category name="org.springframework.beans"> <priority value="debug" /> </category> <category name="org.springframework.security"> <priority value="debug" /> </category> <category name="org.springframework.beans.CachedIntrospectionResults"> <priority value="debug" /> </category> <category name="org.springframework.jdbc.core"> <priority value="debug" /> </category> <category name="org.springframework.transaction.support.TransactionSynchronizationManager"> <priority value="debug" /> </category> <root> <priority value="debug" /> <appender-ref ref="springAppender" /> </root> </log4j:configuration>
Prasanna Talakanti Oct. 20 2018-11-18T00: 00Z
source share