Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1863

Log4J initialized twice for web app

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Auto Closed
    • 1.7.3
    • None
    • None
    • None
    • Windows Server 2012, Windows 7

    Description

      The web application uses slf4j for logging. The logging implementation is log4j. The application contains a log4j.properties file in the WEB-INF\classes directory. The application uses JAX-RS and Stateless EJBs. Log4j is initialized by the TempClassLoader and then again when the webapp is loaded. This results in two OS file handles referencing the same log file (RollingLogFileAppender) that prevents the log file from rolling over. TomEE logging uses the default java.util.logging.

      Log4j Debug Output
      =======================================================
      INFO: Deploying web application archive D:\apps\clean\apache-tomee-plus-1.7.3\webapps\log4jweb.war
      Jul 11, 2016 2:05:48 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
      INFO: ------------------------- localhost -> /log4jweb
      Jul 11, 2016 2:05:48 PM org.apache.openejb.config.ConfigurationFactory configureApplication
      INFO: Configuring enterprise application: D:\apps\clean\apache-tomee-plus-1.7.3\webapps\log4jweb
      log4j: Trying to find [log4j.xml] using context classloader org.apache.openejb.core.TempClassLoader@2e341234.
      log4j: Trying to find [log4j.xml] using org.apache.openejb.core.TempClassLoader@2e341234 class loader.
      log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
      log4j: Trying to find [log4j.properties] using context classloader org.apache.openejb.core.TempClassLoader@2e341234.
      log4j: Using URL file:/D:/apps/clean/apache-tomee-plus-1.7.3/webapps/log4jweb/WEB-INF/classes/log4j.properties for automatic log4j configuration.
      log4j: Reading configuration from URL file:/D:/apps/clean/apache-tomee-plus-1.7.3/webapps/log4jweb/WEB-INF/classes/log4j.properties
      log4j: Parsing for [root] with value=[DEBUG, file].
      log4j: Level token is [DEBUG].
      log4j: Category root set to DEBUG
      log4j: Parsing appender named "file".
      log4j: Parsing layout options for "file".
      log4j: Setting property [conversionPattern] to [%d

      {MM-dd HH:mm:ss,SSS}

      %-5p %32.32c

      {1}:%3.3L - %m%n].
      log4j: End of parsing for "file".
      log4j: Setting property [maxBackupIndex] to [9].
      log4j: Setting property [file] to [D:/apps/clean/apache-tomee-plus-1.7.3/logs/log4jweb.log].
      log4j: Setting property [maxFileSize] to [10KB].
      log4j: setFile called: D:/apps/clean/apache-tomee-plus-1.7.3/logs/log4jweb.log, true
      log4j: setFile ended
      log4j: Parsed "file" options.
      log4j: Parsing for [simple] with value=[DEBUG].
      log4j: Level token is [DEBUG].
      log4j: Category simple set to DEBUG
      log4j: Handling log4j.additivity.simple=[null]
      log4j: Finished configuring.
      ...
      INFO: Enterprise application "D:\apps\clean\apache-tomee-plus-1.7.3\webapps\log4jweb" loaded.
      Jul 11, 2016 2:05:48 PM org.apache.openejb.assembler.classic.Assembler createApplication
      INFO: Assembling app: D:\apps\clean\apache-tomee-plus-1.7.3\webapps\log4jweb
      log4j: Trying to find [log4j.xml] using context classloader LazyStopWebappClassLoader
      context: /log4jweb
      delegate: false
      repositories:
      /WEB-INF/classes/
      ----------> Parent Classloader:
      org.apache.catalina.loader.StandardClassLoader@51521cc1
      .
      log4j: Trying to find [log4j.xml] using LazyStopWebappClassLoader
      context: /log4jweb
      delegate: false
      repositories:
      /WEB-INF/classes/
      ----------> Parent Classloader:
      org.apache.catalina.loader.StandardClassLoader@51521cc1
      class loader.
      log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
      log4j: Trying to find [log4j.properties] using context classloader LazyStopWebappClassLoader
      context: /log4jweb
      delegate: false
      repositories:
      /WEB-INF/classes/
      ----------> Parent Classloader:
      org.apache.catalina.loader.StandardClassLoader@51521cc1
      .
      log4j: Using URL file:/D:/apps/clean/apache-tomee-plus-1.7.3/webapps/log4jweb/WEB-INF/classes/log4j.properties for automatic log4j configuration.
      log4j: Reading configuration from URL file:/D:/apps/clean/apache-tomee-plus-1.7.3/webapps/log4jweb/WEB-INF/classes/log4j.properties
      log4j: Parsing for [root] with value=[DEBUG, file].
      log4j: Level token is [DEBUG].
      log4j: Category root set to DEBUG
      log4j: Parsing appender named "file".
      log4j: Parsing layout options for "file".
      log4j: Setting property [conversionPattern] to [%d{MM-dd HH:mm:ss,SSS} %-5p %32.32c{1}

      :%3.3L - %m%n].
      log4j: End of parsing for "file".
      log4j: Setting property [maxBackupIndex] to [9].
      log4j: Setting property [file] to [D:/apps/clean/apache-tomee-plus-1.7.3/logs/log4jweb.log].
      log4j: Setting property [maxFileSize] to [10KB].
      log4j: setFile called: D:/apps/clean/apache-tomee-plus-1.7.3/logs/log4jweb.log, true
      log4j: setFile ended
      log4j: Parsed "file" options.
      log4j: Parsing for [simple] with value=[DEBUG].
      log4j: Level token is [DEBUG].
      log4j: Category simple set to DEBUG
      log4j: Handling log4j.additivity.simple=[null]
      log4j: Finished configuring.

      Attachments

        Activity

          People

            Unassigned Unassigned
            loua loua
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: