Announcement Announcement Module
No announcement yet.
getting debug level messages from Spring in SpringPortletMVC application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • getting debug level messages from Spring in SpringPortletMVC application

    Hi Spring Forum members,

    I am having problems producing Spring debug messages for my portlet application. I am using log4j successfully for my other log needs. When I add the spring framework class to it nothing is produced. I have seen in the Petclinic application that web.xml entries were necessary, but when I copied them into my app it still did nothing.

    Can someone point me to a clear example to accomplish this using log4j?

    Thanks in advance!


  • #2
    Post your web.xml and log4j.xml / Also, on which portal server are you deploying your portlets? Liferay? IBM WPS?


    • #3
      Hi Enrico,

      Thanks for the response.

      I am using JDeveloper / webcenter It is an integrated IDE with a local weblogic server.

      Here are the files you requested:

      log4j.xml - I do not have one (!) -

      # Root logger option
      # log4j.rootLogger=WARN, file, console
      log4j.rootLogger=DEBUG, file, console
      # Direct log messages to a log file
      log4j.appender.file=org.apache.log4j.RollingFileAp pender
      # this path may need to be filtered, or standardized
      log4j.appender.file.layout=org.apache.log4j.Patter nLayout
      log4j.appender.file.layout.ConversionPattern=%d{AB SOLUTE} %5p %c{1}:%L - %m%n

      # Direct log messages to Console
      log4j.appender.console=org.apache.log4j.ConsoleApp ender
      log4j.appender.console.layout=org.apache.log4j.Pat ternLayout
      log4j.appender.console.layout.ConversionPattern=%d {ABSOLUTE} %5p %c{1}:%L - %m%n

      web.xml -

      <?xml version = '1.0' encoding = 'windows-1252'?>
      <web-app xmlns:xsi=""
      version="2.5" xmlns="">

      <display-name>ROI Review</display-name>

      Key of the system property that should specify the root directory of this
      web app. Applied by WebAppRootListener or Log4jConfigListener.
      steve chg from petclinic.root to /

      Location of the Log4J config file, for initialization and refresh checks.
      Applied by Log4jConfigListener.

      - Configures Log4J for this web app.
      - As this context specifies a context-param "log4jConfigLocation", its file path
      - is used to load the Log4J configuration, including periodic refresh checks.
      - Would fall back to default Log4J initialization (non-refreshing) if no special
      - context-params are given.
      - Exports a "web app root key", i.e. a system property that specifies the root
      - directory of this web app, for usage in log file paths.
      - This web app specifies "petclinic.root" (see file).
      <!-- Leave the listener commented-out if using JBoss -->
      <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>

      <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>

      <servlet-class>org.springframework.web.servlet.ViewRenderer Servlet</servlet-class>


      <!-- Change spring tag lib from /WEB-INF/ to classpath -->

      Thanks !


      • #4

        next time please use CODE tags to post your code / xml / stacktraces.
        For Weblogic server there is a known issue about log4j...just adding the or log4j.xml to the root of the webapp classpath doesn't make it work, as it does in other containers and as it should.
        This is due to how Weblogic classloaders stack works, I won't enter in any detail because this has nothing to do with Spring, but you can google the issue if you're interested.