Search code examples
sqlloggingwso2wso2-micro-integrator

Not being able to fetch the result to log in POST API


I am trying to do post api request and trying to fetch the data through SQL Query, however, I am unable to understand how to log the results. Any help would mean a lot, the code I have written is below:

            <statement>
                <sql><![CDATA[SELECT * FROM TEST2 t WHERE t.CORRELATION_ID = 1]]></sql>
                <result column="CORRELATION_ID" name="CORRELATION_ID"/>
                <result column="MSISDN" name="MSISDN"/>
                <result column="FL" name="FLAG"/>
            </statement>
            <log level="full">
                <property name="After Query" value="Below Query"/>
                <property expression="get-property(FLAG)" name="FLAGG"/>
            </log>

I am not getting any value in logs instead it is printing nothing as the value is given as "FLAGG = ". Thank You


Solution

  • If you get data from the Database the returned values should be assigned to properties. Your Log seems to be a bit off. Can you try the following?

    <log level="full">
      <property name="After Query" value="Below Query"/>
      <property expression="$ctx:FLAG" name="FLAGG"/>
      <property expression="$ctx:CORRELATION_ID" name="CORRELATION_ID"/>
    </log>