Enabling Debugging

During development, it is sometimes necessary to enable debugging on the Mashery Local instance.

To enable debugging:
  1. Log into Mashery Local from the UI, for example: <IP Address of Mashery Local>:5480
  2. Go to Adapter SDK.
  3. Click the Enable debugging check box in the Adapter Debugging section, indicate the port number to which you will connect your debugger, and then click Save.

  4. The Listening at address field (disabled by default), then becomes enabled and the default value is set to 8000.
  5. Click Save again.
Perform the following additional steps:
  • Add the following java system property in the proxy.ini file (File location: /opt/javaproxy/proxy/proxy.ini):
    -Dlogback.configurationFile=/etc/mashery/conf/logback.xml
  • Add the following property into the /etc/mashery-proxy-config.json:
        },
        "com.mashery.proxy.logback.config" : {
            "configURL":"/etc/mashery/conf/logback.xml"
        }
  • Add the logback.xml file with the default log levels set to "debug".
The log file should be present in the location specified in the above block of json (in mashery-proxy-config.json).
    Note: The logback.xml should be present with log levels set to "debug" at path "/etc/mashery/conf/logback.xml". The conf directory needs to be created under "/etc/mashery/".
  • Restart javaproxy (command: service javaproxy restart) and make a test call.
    Note: Make sure log files have write permissions.

The logging data will now be recorded in the 
/var/log/mashery/proxy_debug.log

The usage data will now be recorded in 
the /var/log/mashery/usage.log.

Sample content of logback.xml file

The following is the complete 'logback.xml' file:
<configuration>
 <appender name="PROXY_DEBUG" class="ch.qos.logback.core.FileAppender">
       <file>/var/log/mashery/proxy_debug.log</file>
       <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
               <level>debug</level>
       </filter>
       <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
               <!-- filter misleading errors from SCR (https://bugs.eclipse.org/bugs/show_bug.cgi?id=402750) -->
               <onMatch>DENY</onMatch>
               <evaluator class="com.mashery.proxy.logback.internal.classic.RegexEvaluator">
                       <logger>org\.eclipse\.equinox\.ds</logger>
                       <message>.* Could not bind a reference of component \S+\. The reference is: Reference\[.*cardinality = 0\.\..*\]</message>
               </evaluator>
       </filter>
       <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
               <!-- filter misleading warnings from Spymemcached (https://mashery.jira.com/browse/EIN-326) -->
               <onMatch>DENY</onMatch>
               <evaluator class="com.mashery.proxy.logback.internal.classic.RegexEvaluator">
                       <logger>net\.spy\.memcached\.MemcachedConnection</logger>
                       <message>Could not redistribute to another node, retrying primary node for .*</message>
               </evaluator>
       </filter>
       <encoder>
     <pattern>[%d{yyyy-MM-dd'T'HH:mm:ss'+00:00',GMT}] %-5level [%thread] %logger{36} %X{requestId} - %msg%n%ex</pattern>
   </encoder>
 </appender>
 <logger name="com.mashery.proxy" level="debug"/>
 <root level="debug">
       <appender-ref ref="PROXY_DEBUG" />
 </root>
</configuration>