Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-21030

Default log4j conf is non-optimal for tomcat deployment

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not a bug
    • Affects Version/s: 4.2.e Community, 4.2.f Community, 5.0
    • Fix Version/s: None
    • Component/s: Installer
    • Security Level: external (External user)
    • Labels:
      None
    • Security Severity:
      None

      Description

      When installing Alfresco Community (maybe also Alfresco One) into an external tomcat instance (e.g. tomcat installed via the system's package manager), log4j fails with:

      log4j:ERROR setFile(null,true) call failed.
      Jul 18 09:05:56 alfresco tomcat.service[23326]: java.io.FileNotFoundException: alfresco.log (Permission denied)
      Jul 18 09:05:56 alfresco tomcat.service[23326]: at java.io.FileOutputStream.open(Native Method)
      Jul 18 09:05:56 alfresco tomcat.service[23326]: at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
      <snip>
      

      This can be fixed by creating a file <catalina-shared.loader-path>/alfresco/extension/custom-log4j.properties and adding:

      log4j.rootLogger=error, File
      
      log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
      log4j.appender.File.File=${catalina.base}/logs/alfresco.log
      log4j.appender.File.Append=true
      log4j.appender.File.DatePattern='.'yyyy-MM-dd
      log4j.appender.File.layout=org.apache.log4j.PatternLayout
      log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
      

      This will work, however it will still log the same error because /custom-log4j.properties is only loaded after log4j outputs some initial log messages. This is very confusing esp. for new users and takes forever to figure out!

      I propose setting the default log4j file path to

      ${catalina.base}/logs/alfresco.log

      as this will work for wizard installations as well as for custom tomcat installations.

      The same problem occurs when installing solr from alfresco-solr-5.0.a.war

      My workaround for now is to unpack the .war file, fix WEB-INF/classes/log4j.properties directly an repack it.

        Attachments

          Activity

          Hide
          resplin Richard Esplin added a comment -

          Thank you for documenting this behavior of Alfresco and a workaround.

          Our concern with always putting the alfresco.log under the "logs" subdirectory is that inexperienced administrators are less likely to see it.

          The standard way of deploying Alfresco on the system tomcat is to use the distribution.zip which contains the relevant configuration information, rather than using the installer.

          Though I will close this issue as "Not a bug", we will keep this feedback in mind as we look at better ways of providing a reference deployment of Alfresco that is easier to understand and modify.

          Show
          resplin Richard Esplin added a comment - Thank you for documenting this behavior of Alfresco and a workaround. Our concern with always putting the alfresco.log under the "logs" subdirectory is that inexperienced administrators are less likely to see it. The standard way of deploying Alfresco on the system tomcat is to use the distribution.zip which contains the relevant configuration information, rather than using the installer. Though I will close this issue as "Not a bug", we will keep this feedback in mind as we look at better ways of providing a reference deployment of Alfresco that is easier to understand and modify.

            People

            • Assignee:
              closedissues Closed Issues
              Reporter:
              dags David
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: