4 Replies Latest reply: Jun 7, 2012 11:17 AM by GoColts RSS

    Adobe Drive 4 - log4j.xml settings ignored

    GoColts Community Member

      I've been looking at Adobe Drive 4, both with our custom connector and the sample connectors, and I can't get any changes to the log4j.xml file to be honored. I can adjust the log level from the "Settings" panel of the Adobe Drive 4 Connect UI, but that has two major limitations: 1) It only goes to the "Info" level (there's no Debug or Trace), and 2) Only the com.adobe.* packages get logged

       

      I'm editing the log4j.xml file in what I believe is the correct location for AD4 (C:\Program Files\Common Files\Adobe\AD4ServiceManager\configuration). 

       

      I've added a logger for the sample connectors as described in the SDK documentation:

      <logger name="sample">

            <level value="DEBUG" />

        </logger>

       

      I've also tried manually setting the Root Logger's Priority:

      <root>

              <priority value="debug"></priority>

              <appender-ref ref="AdobeCSIDefaultAppender"/>

          </root>

       

      But after doing this launching Drive, then using the FTP sample connector, no log messages for the connector ever get added to the log file.  I know I'm looking at the correct log file because it gets updated with messages from the com.adobe classes. 

       

      As a test, I also added a call to a com.adobe Logger from within a FTP connector handler class, and it gets added just fine.  For example, from within the sample FTP GetChildrenHadler:

       

      Logger.getLogger(Path.class).info("TEST MESSAGE");  <---  Appears in Log file

       

      Logger.getLogger(GetChildrenHandler.class).info("TEST MESSAGE");  <---  Does not appear in Log file

       

       

      Is there something else I need to do to get AD4 to use the log4j.xml configuration? 

        • 1. Re: Adobe Drive 4 - log4j.xml settings ignored
          jiali@adobe.com

          Hi GoColts:

           

          Do you try to just update following setting as you needed and keep other no change:

           

          orginal:

          <logger name="com.adobe">

                <level value="error" />

            </logger>

           

          updated:

           

          <logger name="sample">

                <level value="debug" />

            </logger>

           

          Thanks,

          Jianfeng

          • 2. Re: Adobe Drive 4 - log4j.xml settings ignored
            GoColts Community Member

            Hi Jianfeng, thanks for your response.

             

            I tried making only the change you suggested, but the result was the same.

             

            I reverted back to the original log4j.xml (as installed), then replaced the com.adobe logger with the sample logger as you suggested (full file contents below).  After making the change and restarting Adobe Drive, I still get the same behavior as I mentioned in my original post. 

             

            To recap (all of these test calls were put at the beginning of the FTP connector's GetChildrenHander.execute() method) :

             

            Using a com.adobe logger, messages show up based on the Log Level setting in the Adobe Drive UI dialog:

            Logger.getLogger(Path.class).debug("TEST MESSAGE")  <-- Never appears in log file

            Logger.getLogger(Path.class).info("TEST MESSAGE")  <-- Appears if Log Level setting is Info

            Logger.getLogger(Path.class).warn("TEST MESSAGE")  <-- Appears if Log Level setting is Info or Warn

            Logger.getLogger(Path.class).error("TEST MESSAGE")  <-- Always appears

             

            Using a sample package logger, only ERROR and FATAL-level messages show up, regardless of the Log Level setting in the Adobe Drive UI dialog.  I assume this is because the Root logger threshold is fixed at ERROR level.  For example:

            Logger.getLogger(GetChildrenHandler.class).debug("TEST MESSAGE");  <---  Does not appear in Log file

            Logger.getLogger(GetChildrenHandler.class).info("TEST MESSAGE");  <---  Does not appear in Log file

            Logger.getLogger(GetChildrenHandler.class).warn("TEST MESSAGE");  <---  Does not appear in Log file

            Logger.getLogger(GetChildrenHandler.class).error("TEST MESSAGE");  <---  Appears in Log file

             

            Thanks for your help,

            Brian (aka GoColts)

             

            Full log4j.xml file contents (after replace com.adobe logger with sample logger):

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >

            <log4j:configuration>

             

                <!-- DO NOT CHANGE THIS APPENDER -->

                <appender name="AdobeCSIDefaultAppender" class="org.apache.log4j.RollingFileAppender">

                    <param name="maxFileSize" value="1MB" />

                    <param name="maxBackupIndex" value="5" />

                    <param name="File" value="${user.dir}/logs/AD4ServiceManager_java.log" />

                    <layout class="org.apache.log4j.PatternLayout">

                        <param name="ConversionPattern"

                            value="%d{yyyy/MM/dd HH:mm:ss,SSS} [%t] %-5p %c{1} - %m %n" />

                    </layout>

                </appender>

             

                <logger name="sample">

                    <level value="debug" />

                </logger>

             

                <logger name="org.hibernate.cache.ReadWriteCache">

                    <level value="error" />

                </logger>

             

                <!-- AbstractFlushingEventListener will always log StaleObjectStateExceptions, even when handled later on -->

                <logger name="org.hibernate.event.def.AbstractFlushingEventListener">

                    <level value="fatal" />

                </logger>

             

                <root>

                    <priority value="error"></priority>

                    <appender-ref ref="AdobeCSIDefaultAppender"/>

                </root>

            </log4j:configuration>

            • 3. Re: Adobe Drive 4 - log4j.xml settings ignored
              Gang_Z Community Member

              Hi GoColts

               

              Yes, what you found is correct, Currently the logging level change from the Connect UI only applies to the com.adobe.* packages, and the logging level only goes to the "Info" level.

               

              For your case, I think you should manually change the log4j.xml as follows:


               

                  <logger name="sample">

                      <level value="debug" />

                  </logger>

                

                  <root>

                      <priority value="debug"></priority>

                      <appender-ref ref="AdobeCSIDefaultAppender"/>

                  </root>

               

               

              please check whether you can find the entry log "

              -->In()" of the sample.basicftp's ConnectHandler


              • 4. Re: Adobe Drive 4 - log4j.xml settings ignored
                GoColts Community Member

                Hi Gang_Z,

                 

                I understand that the Connect UI logging level only affects the com.adobe.* packages.  That makes sense to me.

                 

                I changed the priority of the root logger to "debug" as you described, but it has no effect.  I made sure to fully shut down & restart Adobe Drive (killing the AD4ServiceManager process, etc.) before trying it again.  After making the change, it is still the case that only ERROR and FATAL -level messages from the sample.basicftp Connector get logged.  No DEBUG, INFO, or WARNING messages appear in the log.  It doesn't seem like the log4j.xml file is having any effect on the logging behavior.

                 

                Thanks,

                Brian