<?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 Write AMP log into a separate logger file? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278816#M231946</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm currently using the "org.apache.log4j.Logger" to write logs in the Java controllers of web scripts for the AMP I'm working on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have noticed that the logs are written in "Alfresco.log" file. It is possible that I can write logs of an AMP into a separate file, e.g. my_amp.log?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sun&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2014 11:27:15 GMT</pubDate>
    <dc:creator>sunquanbin</dc:creator>
    <dc:date>2014-06-20T11:27:15Z</dc:date>
    <item>
      <title>Write AMP log into a separate logger file?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278816#M231946</link>
      <description>Hi,I'm currently using the "org.apache.log4j.Logger" to write logs in the Java controllers of web scripts for the AMP I'm working on.I have noticed that the logs are written in "Alfresco.log" file. It is possible that I can write logs of an AMP into a separate file, e.g. my_amp.log?Regards,Sun</description>
      <pubDate>Fri, 20 Jun 2014 11:27:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278816#M231946</guid>
      <dc:creator>sunquanbin</dc:creator>
      <dc:date>2014-06-20T11:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Write AMP log into a separate logger file?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278817#M231947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Of course you can,it is the same with configuring separate log file for different categories in log4j.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just create a log4j configure file for your module,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in your log4j file configure a new file appender,for example&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;log4j.appender.moduleLog=org.apache.log4j.FileAppender&lt;BR /&gt;log4j.appender.moduleLog.File=yourmodule.log&lt;BR /&gt;log4j.appender.moduleLog.layout=org.apache.log4j.PatternLayout&lt;BR /&gt;log4j.appender.moduleLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;then configure you module class to use the appender.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;log4j.logger.com.yourcompany.your.module=info,moduleLog&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2014 03:14:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278817#M231947</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-06-21T03:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Write AMP log into a separate logger file?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278818#M231948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi kaynezhang,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply, but I cannot get it to work. In the built amp file, I have two two log4j.properties files in the following path:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;1: my_module_id.amp\log4j.properties&lt;BR /&gt;2: my_module_id.amp\config\alfresco\module\my_module_id\&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the first file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;log4j.logger.my_module_id=info,moduleLog&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the second file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;log4j.appender.moduleLog=org.apache.log4j.FileAppender&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.File=my_module_id.log&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.layout=org.apache.log4j.PatternLayout&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the java code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;logger.error("test error msg");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error still was logged in alfresco.log file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sun&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 09:11:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278818#M231948</guid>
      <dc:creator>sunquanbin</dc:creator>
      <dc:date>2014-06-24T09:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Write AMP log into a separate logger file?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278819#M231949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1.First you must place your log4j.properties file in correct location,you should place and name it under following pattern&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;classpath*:alfresco/module/*/log4j.properties&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.Second why did you separate your module log4j configuration into two files ? following is a sample module log4j config file,you can copy and past it into your amp log4j.properties .it should work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;log4j.rootLogger=TRACE, stdout&lt;BR /&gt;&lt;BR /&gt;log4j.appender.stdout=org.apache.log4j.ConsoleAppender&lt;BR /&gt;log4j.appender.stdout.layout=org.apache.log4j.PatternLayout&lt;BR /&gt;log4j.appender.stdout.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog=org.apache.log4j.FileAppender&lt;BR /&gt;log4j.appender.moduleLog.File=my_module_id.log&lt;BR /&gt;log4j.appender.moduleLog.layout=org.apache.log4j.PatternLayout&lt;BR /&gt;log4j.appender.moduleLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n&lt;BR /&gt;&lt;BR /&gt;log4j.logger.com.yourcompany.your.custom.demo=info,moduleLog&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 09:33:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278819#M231949</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-06-24T09:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Write AMP log into a separate logger file?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278820#M231950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks very much. I have used the second section of your settings, as the first section makes the programming not running properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog=org.apache.log4j.FileAppender&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.File=my_module_id.log&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.layout=org.apache.log4j.PatternLayout&lt;BR /&gt;&lt;BR /&gt;log4j.appender.moduleLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n &lt;BR /&gt;&lt;BR /&gt;log4j.logger.com.yourcompany.your.custom.demo=info,moduleLog&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now only use 1 file in the path you specified. It works now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason to have 2 files it's because I'm using the Maven alfresco SDK and it comes with 2 files.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 12:27:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/write-amp-log-into-a-separate-logger-file/m-p/278820#M231950</guid>
      <dc:creator>sunquanbin</dc:creator>
      <dc:date>2014-06-24T12:27:12Z</dc:date>
    </item>
  </channel>
</rss>

