How to turn logging on for RESTAPI problems?

Version 24
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Remedy AR System Server


    COMPONENT:

    AR System Server


    APPLIES TO:

    REST API troubleshooting , logs , AR System Server 9.1.03 And Ar system server 9.1.04 only #REST API logs(NOT for AR Server 9.1.0)



    QUESTION:

    How to turn on the server side logging for REST API ? 
    OR 
    How to troubleshoot REST API logs ?
    For AR Server 9.1.03 and later


    ANSWER:

    Options are mutually exclusive. If using option 1, do not use any parts of option 2 or vice-versa.
    If using Option 1 , there is no need to modify the Root level logger to DEBUG. 

    Option 1:
    In logback_server.xml, add the following under <configuration> tag  (Note:  the logback_server.xml is found in the conf directory on the AR Server)

          <appender name="RestAPILog"  
            class="com.bmc.arsys.logging.ReconfigurableRollingFileAppender">  
            <file>${com.bmc.arsys.homedir}/${com.bmc.arsys.server.dbdir}/restapi.log</file>  
            <append>true</append>  
           <param name="Encoding" value="UTF-8" />   
            <rollingPolicy class="com.bmc.arsys.logging.StoredRollingPolicy">  
                <fileNamePattern>${com.bmc.arsys.homedir}/${com.bmc.arsys.server.dbdir}/restapi.log.%i</fileNamePattern>  
                <minIndex>1</minIndex>  
                <maxIndex>8</maxIndex>  
            </rollingPolicy>  
            <triggeringPolicy             class="com.bmc.arsys.logging.ARSizeBasedTriggeringPolicy">  
                <maxFileSize>128MB</maxFileSize>  
            </triggeringPolicy>  
            <!-- Extra param to say log file creation at startup -->  
            <needPreLoading>true</needPreLoading>  
            <encoder>  
                <pattern>%d{EEE MMM dd HH:mm:ss.SSS yyyy} [%thread] %-5level %logger{36} %m%nopex%n</pattern>  
            </encoder>  
        </appender> 
      
    Then also add  
     
    <logger name="com.bmc.arsys.restapi.features" level="debug" additivity="false">  
            <appender-ref ref="RestAPILog" />  
         </logger>  
        <logger name="com.bmc.arsys.restapi" level="debug" additivity="false">  
            <appender-ref ref="RestAPILog" />  
        </logger>  
        <logger name="org.eclipse.jetty" level="debug" additivity="false">  
            <appender-ref ref="RestAPILog" />  
        </logger> 
      
    Optionally, comment out the following as this information will now be on restapilog   
          <!--  
        <logger name="com.bmc.arsys.restapi.features" level="error"  
            additivity="false">  
            <appender-ref ref="ServerLog" />  
            <appender-ref ref="DebugLog" />  
        </logger>  
        <logger name="com.bmc.arsys.restapi" level="debug" additivity="false">  
            <appender-ref ref="Console" />  
            <appender-ref ref="StartupTraceLog" />  
        </logger> --> 
         
    See the attached logback_server.xml that includes a separate log for REST API and WEBSERVICES following the same pattern 
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
    Option 2:
    In the file logback_server.xml ,change the root level to DEBUG. (Note, the logback_server.xml file is found in the conf directory on the AR Server) 
    Even though this works, it creates a lot of information in the arerror.log.  It is discouraged as it can slow things down and create a lot of unnecessary information on the arerror.log.  
         From this  
    <!--Set root category priority to error appenders to the server log file --> <root level="error"> <appender-ref ref="ServerLog" /> <appender-ref ref="Console" /> <appender-ref ref="DebugLog" /> </root>
         To this  
    <!--Set root category priority to error appenders to the server log file --> <root level="DEBUG"> <appender-ref ref="ServerLog" /> <appender-ref ref="Console" /> <appender-ref ref="DebugLog" /> </root>
      

       

    Restart the AR server or use the Reload Log Conf File option on the Server Information form, Log Files tab.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    To confirm that the logging was enabled:

    For Option 1
    tail -f restapi.log | grep ".jetty."
     

      

    For Option 2)
    tail -f arerror.log | grep SSL


    For AR System 18.08 and newer.
     

    Enable jetty log level in the   arserver.config file for Windows and in the   arserverd.conf file for  Linux. Use the following JVM option: 
    -Dorg.eclipse.jetty.LEVEL=DEBUG 

    Enable extra Jetty Related logs in the   Jetty/etc/Jetty.xml

    <Call
    class="org.eclipse.jetty.util.log.Log"
    name="getRootLogger">
             <Call
    name="setDebugEnabled">
                 <Arg  type="boolean">false</Arg>
             </Call>  

    Change this boolean value to true.

    Once you enable the logging, the jetty logs are displayed on the server console or in the armonitor.log file.  

    READING THE LOGS
    On Windows, just look for SSL if its enabled.  It will throw a lot of activity even just restarting

      
       
    1. To get Jetty startup logs,go to arerror.log. Below are some patterns found that can be used as reference .     
           
      1. Port opened : Thu Aug 04 07:42:29.610 2016 Container org.eclipse.jetty.server.Server@75c56eb9 + SslSelectChannelConnector@0.0.0.0:10443 as connector
      2.    
      3. Keystore not found: Thu Aug 04 07:09:11.205 2016 FAILED SslContextFactory@52815fa3(./jetty./etc/keystore,./jetty./etc/keystore): java.io.FileNotFoundException: C:\Program Files\BMC Software\ARSystem\jetty\etc\keystore (The system cannot find the file specified)
      4.    
      5. Port not being opened: Thu Aug 04 07:09:12.205 2016 STOPPED SslSelectChannelConnector@0.0.0.0:10443
      6.   
      
       
    1. To get jetty low level activity from REST API, go to arerror.log     
           
      1. New incoming connection : Thu Aug 04 07:27:14.999 2016 created SCEP@52bd234d{l(/172.18.142.70:57748)<->r(/172.22.233.120:10443),s=0,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{SslConnection@c1ac5b7 SSL NOT_HANDSHAKING i/o/u=-1/-1/-1 ishut=false oshut=false {AsyncHttpConnection@71029044,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}
      2.    
      3. Trace your session with Session-Number       
               
        1. Thu Aug 04 07:27:14.999 2016 [Session-1, SSL_NULL_WITH_NULL_NULL] SslConnection…
        2.      
        3. Thu Aug 04 07:27:14.999 2016 [Session-1, SSL_NULL_WITH_NULL_NULL] handle SslCon…
        4.      
        5. Thu Aug 04 07:27:14.999 2016 [Session-1, SSL_NULL_WITH_NULL_NULL] SslConnection…
        6.      
        7. Thu Aug 04 07:27:14.999 2016 [Session-1, SSL_NULL_WITH_NULL_NULL] unwrap OK NEE…
        8.     
      4.    
      5. Session ended:       
               
        1. Thu Aug 04 07:27:14.999 2016 [Session-1, SSL_NULL_WITH_NULL_NULL] handle SslConnection@c1ac5b7 SSL NEED_UNWRAP i/o/u=0/0/0 ishut=false oshut=false {AsyncHttpConnection@71029044,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0} progress=false
        2.     
      6.   
    2.  
    3. To see the actual API calls, enable API logs     
           
      1. Line 2323: <API > <TID: 0000000336> <RPC ID: 0000000014> <Queue: Fast      > <Client-RPC: 390620   > <USER: Demo                                         > <Overlay-Group: 1         > /* Thu Aug 04 2016 07:53:34.0680 */ +GS      ARGetSchema -- schema User from Unidentified Client (protocol 19) at IP address 172.18.142.70 using REST // :q:0.0s
      2.    
      3. Line 2325: <API > <TID: 0000000336> <RPC ID: 0000000014> <Queue: Fast      > <Client-RPC: 390620   > <USER: Demo                                         > <Overlay-Group: 1         > /* Thu Aug 04 2016 07:53:34.0840 */ +GLEWF   ARGetListEntryWithFields -- schema User from Unidentified Client (protocol 19) at IP address 172.18.142.70 using REST // :q:0.0s
      4.    
      5. Line 2338: <API > <TID: 0000000322> <RPC ID: 0000000015> <Queue: Fast      > <Client-RPC: 390620   > <USER: Demo                                         > <Overlay-Group: 1         > /* Thu Aug 04 2016 07:53:34.7710 */ +GS      ARGetSchema -- schema User from Unidentified Client (protocol 19) at IP address 172.18.142.70 using REST // :q:0.0s
      6.    
      7. Line 2341: <API > <TID: 0000000322> <RPC ID: 0000000015> <Queue: Fast      > <Client-RPC: 390620   > <USER: Demo                                         > <Overlay-Group: 1         > /* Thu Aug 04 2016 07:53:34.7870 */ +GLEWF   ARGetListEntryWithFields -- schema User from Unidentified Client (protocol 19) at IP address 172.18.142.70 using REST // :q:0.0s
      8.    
      9. Line 2508: <API > <TID: 0000000322> <RPC ID: 0000000016> <Queue: Fast      > <Client-RPC: 390620   > <USER: Demo                                         > <Overlay-Group: 1         > /* Thu Aug 04 2016 07:53:42.1620 */ +GS      ARGetSchema -- schema TMS:Task from Unidentified Client (protocol 19) at IP address 172.18.142.70 using REST // :q:0.0s
      10.   

     


    Article Number:

    000133102


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles