-1

I am working in a springMVC application. I have a request mapping which is directly returning a view without processing the lines in between.

@RequestMapping(value = { "/testCnt" }, method = { RequestMethod.GET })
public ModelAndView testContent(HttpServletRequest request) {

    log.debug("testing debug");
    ModelAndView mnv = new ModelAndView();
    log.debug("testssss");
    log.debug("test purpose");
    //some procesing here....Calling other methods and doing the required process
   ........
   ........
   mnv.setViewName("returnjsp");
    return mnv;
}

So for the above code i can see the following in the log statements:

2017-11-26 22:01:56,388 DEBUG org.springframework.web.servlet.DispatcherServlet DispatcherServlet with name 'SiteServlet' processing GET request for [/mysite/site/ContentTest/testCnt]
2017-11-26 22:01:56,389 DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Looking up handler method for path /ContentTest/testCnt
2017-11-26 22:01:56,394 DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Returning handler method [public org.springframework.web.servlet.ModelAndView myproject.org.com.TestCountController.testContent(javax.servlet.http.HttpServletRequest)]
2017-11-26 22:01:56,394 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Returning cached instance of singleton bean 'testCountController'
2017-11-26 22:01:56,401 DEBUG org.springframework.web.servlet.DispatcherServlet Last-Modified value for [/portal/site/ContentTest/testCnt
] is: -1


2017-11-26 22:01:58,850 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Invoking afterPropertiesSet() on bean with name 'returnjsp'

I dont see my log statements in the log which is the very first line of the execution. It directly returns a view to "returnjsp" without processing the content in this method. Please help

Stack
  • 33
  • 1
  • 6

3 Answers3

0

It looks like controller method is getting executed. Some troubleshooting points:

  1. Try to cross check that your log order is set to DEBUG level.
  2. Try to use Sysouts for now to cross check that method is working.

Last thing is your log.debug("testing debug); should be properly closed like below:

log.debug("testing debug");
Pramod S. Nikam
  • 4,271
  • 4
  • 38
  • 62
0

Are you sure you are running compiled code? Because what you've pasted can't be compiled because of missing double quotes : log.debug("testing debug);

Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24
0

As per the problem statement it seems that you have not activated the debug level Logs. Please check you have log4j.properties file in your class path and its log level is set to DEBUG.

Naresh Bharadwaj
  • 192
  • 1
  • 12
  • How to check for log4j.properties? Can you please help where will be configutre the path for this file? @NareshBharadwaj – Stack Nov 27 '17 at 05:25
  • Please check this link. https://stackoverflow.com/questions/5081316/where-is-the-correct-location-to-put-log4j-properties-in-an-eclipse-project. – Naresh Bharadwaj Nov 27 '17 at 07:41