Alfresco
  1. Alfresco
  2. ALF-21030

Default log4j conf is non-optimal for tomcat deployment

    Details

    • Type: Bug Bug
    • Status: New (View Workflow)
    • Priority: Major Major
    • Resolution: Unresolved
    • 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
    • Triage:
      To Do

      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.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            PM Unassigned
            Reporter:
            David
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: