<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Log4j2 Definition in ACS 7.4+ in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148376#M39223</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;after lots of tests we found out the solution, following the&lt;STRONG&gt; [MNT-24306] Added fix for log4j2 config issue.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In order to get the logs inside the docker environment created by the run.sh build_start command you need to:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1) Edit the following 2 files:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;1.1) &lt;STRONG&gt;Dockerfile&lt;/STRONG&gt; inside the &amp;lt;my-project&amp;gt;-platform-docker module&lt;/P&gt;&lt;PRE&gt;FROM ${docker.acs.image}:${alfresco.platform.version}

ARG TOMCAT_DIR=/usr/local/tomcat
ARG USERNAME=${alfresco.platform.docker.user} 

USER root

# Copy Dockerfile to avoid an error if no JARs exist
COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/

# Copy Dockerfile to avoid an error if no AMPs exist
COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
              $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force

COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties
COPY dev-log4j2.properties $TOMCAT_DIR/shared/classes/alfresco/extension/dev-log4j2.properties
COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension

# Copy Dockerfile to avoid an error if no license file exists
COPY Dockerfile license/*.* $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes/alfresco/extension/license/

# Move the log file
RUN sed -i -e "s_appender.rolling.fileName\=alfresco.log_appender.rolling.fileName\=${TOMCAT_DIR}/logs\/alfresco.log_" \
        ${TOMCAT_DIR}/shared/classes/alfresco/extension/dev-log4j2.properties &amp;amp;&amp;amp; \
    sed -i -e "s_appender.rolling.filePattern=alfresco.log.%d{yyyy-MM-dd}_appender.rolling.filePattern\=${TOMCAT_DIR}/logs\/alfresco.log.%d{yyyy-MM-dd}_" \
        ${TOMCAT_DIR}/shared/classes/alfresco/extension/dev-log4j2.properties

USER ${USERNAME}&lt;/PRE&gt;&lt;P&gt;1.2)&lt;STRONG&gt; dev-log4j2.properties&lt;/STRONG&gt;&amp;nbsp;inside the &amp;lt;my-project&amp;gt;-platform-docker module&lt;/P&gt;&lt;PRE&gt;rootLogger.level=error
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender

.....&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;.....&lt;BR /&gt;&lt;BR /&gt;# Authorization
logger.alfresco-enterprise-repo-authorization-AuthorizationService.name=org.alfresco.enterprise.repo.authorization.AuthorizationService
logger.alfresco-enterprise-repo-authorization-AuthorizationService.level=info

logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.name=org.alfresco.enterprise.repo.authorization.AuthorizationsConsistencyMonitor
logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.level=warn&lt;/PRE&gt;&lt;P&gt;From line 1 to line 402 of this link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-sdk/blob/c0054d34a1b140cd175d89e8873ab16c54cef9fd/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/src/main/docker/dev-log4j2.properties" target="_self" rel="nofollow noopener noreferrer"&gt;https://github.com/Alfresco/alfresco-sdk/blob/c0054d34a1b140cd175d89e8873ab16c54cef9fd/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/src/main/docker/dev-log4j2.properties&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2) Add your package configuration at the end of the dev-log4j2.properties&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.my-name.name=&lt;/SPAN&gt;&lt;SPAN&gt;my.package&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.my-name.level=&lt;/SPAN&gt;&lt;SPAN&gt;debug&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;With this configuration it works in your local docker environment&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively you can use the log4j2.properties file located in &amp;lt;myproject&amp;gt;-platform/src/main/resources/alfresco/module/&amp;lt;my-module&amp;gt; with the same configuration above.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;CARE: this configuration will OVERRIDE the dev-log4j2.properties&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;STRONG&gt;3) Inside your class you can now log with&lt;/STRONG&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
&lt;BR /&gt;//inside your class
private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
&lt;BR /&gt;//inside your method
logger.debug("Test debug logging. Congratulation your JAR Module is working");
logger.info("This is only for information purposes. Better remove me from the log in Production");&lt;/PRE&gt;&lt;U&gt;CARE: do not use org.apache.commons.logging as for us it didn't work (even if is the method used inside the DemoComponent of the SDK)&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;Thank you&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;Luca &amp;amp; Robin&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 11 Jun 2024 11:21:17 GMT</pubDate>
    <dc:creator>luca_biondo</dc:creator>
    <dc:date>2024-06-11T11:21:17Z</dc:date>
    <item>
      <title>Custom Log4j2 Definition in ACS 7.4+</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148374#M39221</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi all&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I&lt;/SPAN&gt;&lt;SPAN&gt;'m going crazy over a trivial configuration of log4j2 on alfresco &lt;/SPAN&gt;&lt;SPAN&gt;7&lt;/SPAN&gt;&lt;SPAN&gt;.4&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Have any of you ever had problems declaring new custom loggers for new module packages using the standard Docker Deployment with SDK &lt;/SPAN&gt;&lt;SPAN&gt;4&lt;/SPAN&gt;&lt;SPAN&gt;.8 for ACS&lt;/SPAN&gt;&lt;SPAN&gt;? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I followed this guide &lt;/SPAN&gt;&lt;A class="" title="https://docs.alfresco.com/content-services/latest/upgrade/log4j2-migrate/" href="https://docs.alfresco.com/content-services/latest/upgrade/log4j2-migrate/" target="_blank" rel="noreferrer noopener nofollow"&gt;&lt;SPAN&gt;https://docs.alfresco.com/content-services/latest/upgrade/log4j2-migrate/&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; but it seems that it doesn&lt;/SPAN&gt;&lt;SPAN&gt;'t take my custom configuration in any case&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt; I tried editing custom&lt;/SPAN&gt;&lt;SPAN&gt;-log4j&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;.properties defined under src&lt;/SPAN&gt;&lt;SPAN&gt;/main&lt;/SPAN&gt;&lt;SPAN&gt;/resources&lt;/SPAN&gt;&lt;SPAN&gt;/alfresco&lt;/SPAN&gt;&lt;SPAN&gt;/module&lt;/SPAN&gt;&lt;SPAN&gt;/mymodule&lt;/SPAN&gt;&lt;SPAN&gt;/ and also dev&lt;/SPAN&gt;&lt;SPAN&gt;-log4j&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;.properties defined in the platform docker project&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My custom logger definitions follow exactly the structure of the guide I linked before from the alfresco documentation&lt;/SPAN&gt;&lt;SPAN&gt;. Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 15:03:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148374#M39221</guid>
      <dc:creator>robinp</dc:creator>
      <dc:date>2024-06-10T15:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Log4j2 Definition in ACS 7.4+</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148375#M39222</link>
      <description>&lt;P&gt;It looks like there is a problem with the SDK.&lt;/P&gt;
&lt;P&gt;This PR seems to fix the issue: &lt;A href="https://github.com/Alfresco/alfresco-sdk/pull/664" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Alfresco/alfresco-sdk/pull/664&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 10:30:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148375#M39222</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2024-06-11T10:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Log4j2 Definition in ACS 7.4+</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148376#M39223</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;after lots of tests we found out the solution, following the&lt;STRONG&gt; [MNT-24306] Added fix for log4j2 config issue.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In order to get the logs inside the docker environment created by the run.sh build_start command you need to:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1) Edit the following 2 files:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;1.1) &lt;STRONG&gt;Dockerfile&lt;/STRONG&gt; inside the &amp;lt;my-project&amp;gt;-platform-docker module&lt;/P&gt;&lt;PRE&gt;FROM ${docker.acs.image}:${alfresco.platform.version}

ARG TOMCAT_DIR=/usr/local/tomcat
ARG USERNAME=${alfresco.platform.docker.user} 

USER root

# Copy Dockerfile to avoid an error if no JARs exist
COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/

# Copy Dockerfile to avoid an error if no AMPs exist
COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
              $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force

COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties
COPY dev-log4j2.properties $TOMCAT_DIR/shared/classes/alfresco/extension/dev-log4j2.properties
COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension

# Copy Dockerfile to avoid an error if no license file exists
COPY Dockerfile license/*.* $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes/alfresco/extension/license/

# Move the log file
RUN sed -i -e "s_appender.rolling.fileName\=alfresco.log_appender.rolling.fileName\=${TOMCAT_DIR}/logs\/alfresco.log_" \
        ${TOMCAT_DIR}/shared/classes/alfresco/extension/dev-log4j2.properties &amp;amp;&amp;amp; \
    sed -i -e "s_appender.rolling.filePattern=alfresco.log.%d{yyyy-MM-dd}_appender.rolling.filePattern\=${TOMCAT_DIR}/logs\/alfresco.log.%d{yyyy-MM-dd}_" \
        ${TOMCAT_DIR}/shared/classes/alfresco/extension/dev-log4j2.properties

USER ${USERNAME}&lt;/PRE&gt;&lt;P&gt;1.2)&lt;STRONG&gt; dev-log4j2.properties&lt;/STRONG&gt;&amp;nbsp;inside the &amp;lt;my-project&amp;gt;-platform-docker module&lt;/P&gt;&lt;PRE&gt;rootLogger.level=error
rootLogger.appenderRef.stdout.ref=ConsoleAppender
rootLogger.appenderRef.rolling.ref=RollingAppender

.....&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;.....&lt;BR /&gt;&lt;BR /&gt;# Authorization
logger.alfresco-enterprise-repo-authorization-AuthorizationService.name=org.alfresco.enterprise.repo.authorization.AuthorizationService
logger.alfresco-enterprise-repo-authorization-AuthorizationService.level=info

logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.name=org.alfresco.enterprise.repo.authorization.AuthorizationsConsistencyMonitor
logger.alfresco-enterprise-repo-authorization-AuthorizationsConsistencyMonitor.level=warn&lt;/PRE&gt;&lt;P&gt;From line 1 to line 402 of this link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-sdk/blob/c0054d34a1b140cd175d89e8873ab16c54cef9fd/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/src/main/docker/dev-log4j2.properties" target="_self" rel="nofollow noopener noreferrer"&gt;https://github.com/Alfresco/alfresco-sdk/blob/c0054d34a1b140cd175d89e8873ab16c54cef9fd/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/src/main/docker/dev-log4j2.properties&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2) Add your package configuration at the end of the dev-log4j2.properties&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.my-name.name=&lt;/SPAN&gt;&lt;SPAN&gt;my.package&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.my-name.level=&lt;/SPAN&gt;&lt;SPAN&gt;debug&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;With this configuration it works in your local docker environment&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively you can use the log4j2.properties file located in &amp;lt;myproject&amp;gt;-platform/src/main/resources/alfresco/module/&amp;lt;my-module&amp;gt; with the same configuration above.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;CARE: this configuration will OVERRIDE the dev-log4j2.properties&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;STRONG&gt;3) Inside your class you can now log with&lt;/STRONG&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
&lt;BR /&gt;//inside your class
private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
&lt;BR /&gt;//inside your method
logger.debug("Test debug logging. Congratulation your JAR Module is working");
logger.info("This is only for information purposes. Better remove me from the log in Production");&lt;/PRE&gt;&lt;U&gt;CARE: do not use org.apache.commons.logging as for us it didn't work (even if is the method used inside the DemoComponent of the SDK)&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;Thank you&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;Luca &amp;amp; Robin&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Jun 2024 11:21:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148376#M39223</guid>
      <dc:creator>luca_biondo</dc:creator>
      <dc:date>2024-06-11T11:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Log4j2 Definition in ACS 7.4+</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148377#M39224</link>
      <description>&lt;P&gt;great!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 15:27:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/148377#M39224</guid>
      <dc:creator>lucastancapiano</dc:creator>
      <dc:date>2024-06-11T15:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Log4j2 Definition in ACS 7.4+</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/483547#M39439</link>
      <description>&lt;P&gt;Does this also work for a Kubernetes environment?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 13:27:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/custom-log4j2-definition-in-acs-7-4/m-p/483547#M39439</guid>
      <dc:creator>dilanluc</dc:creator>
      <dc:date>2024-10-18T13:27:50Z</dc:date>
    </item>
  </channel>
</rss>

