Hi Milan,

I noticed that in your config, you are not setting the logger for the
TestAPI, it is the setup for the all APIs.

That should be the why. Could you try adding the API specifc logger?

Thanks,

2018-02-08 14:11 GMT-02:00 Milan Perera <mi...@wso2.com>:

> Hi Fransisco,
>
> I have tested the same API payload that you mentioned above in EI 6.1.1 by
> adding the following log4j configuration as mentioned in the
> documentation[1].
>
> log4j.category.API_LOGGER=INFO, API_APPENDER
> log4j.additivity.API_LOGGER=false
> log4j.appender.API_APPENDER=org.apache.log4j.RollingFileAppender
> log4j.appender.API_APPENDER.File=${carbon.home}/
> repository/logs/TestAPI.log
> log4j.appender.API_APPENDER.MaxFileSize=1000KB
> log4j.appender.API_APPENDER.MaxBackupIndex=10
> log4j.appender.API_APPENDER.layout=org.apache.log4j.PatternLayout
> log4j.appender.API_APPENDER.layout.ConversionPattern=%d{ISO8601}
> [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n</pre>
>
> As the result, I've got the logs on TestAPI.log file inside 
> <EI>/repository/logs/
> directory as below.
>
> 2018-02-08 21:29:53,584 [-] [localhost-startStop-1]  INFO TestAPI
> Initializing API: TestAPI
> </pre>2018-02-08 21:29:59,917 [-] [PassThroughMessageProcessor-1]  INFO
> TestAPI To: /testapi/test, MessageID: 
> urn:uuid:a76bd1ad-9fdc-441d-a187-07136225f220,
> Direction: request, INSIDE API = INSIDE API, Envelope: <?xml version='1.0'
> encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.
> xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
> </pre>2018-02-08 21:29:59,934 [-] [SynapseWorker-1]  INFO TestAPI To:
> /testapi/test, MessageID: urn:uuid:69b6de05-9422-450e-b366-3efc9cda5f3b,
> Direction: request, INSIDE CLONE = INSIDE CLONE, SYNAPSE_REST_API =
> TestAPI, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><
> soapenv:Body/></soapenv:Envelope>
>
> As you can see, both INSIDE_API log and INSIDE_CLONE were there.
>
> What is the version you are trying this? Also, would you be able to try
> out the above mentioned log4j configuration?
>
> [1] https://docs.wso2.com/display/EI611/Per-API+Logs+in+WSO2+EI
>
> Thank you.
>
> On Mon, Feb 5, 2018 at 2:18 AM, Júnior <fjunio...@gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to have a Log per api, I have configured log4j.properties as
>> said in the documentation. But it is not fully working.
>>
>> See the API below:
>>
>> <api xmlns="http://ws.apache.org/ns/synapse"; name="TestAPI" 
>> context="/testapi">
>>    <resource methods="GET" uri-template="/test">
>>       <inSequence>
>>          <log level="full">
>>             <property name="INSIDE API" value="INSIDE API"/>
>>          </log>
>>          <clone continueParent="true">
>>             <target>
>>                <sequence>
>>                   <log level="full">
>>                      <property name="INSIDE CLONE" value="INSIDE CLONE"/>
>>                      <property name="SYNAPSE_REST_API" 
>> expression="$ctx:SYNAPSE_REST_API"/>
>>                   </log>
>>                </sequence>
>>             </target>
>>          </clone>
>>       </inSequence>
>>    </resource></api>
>>
>>
>>
>> The log statement inside the inSquence is displayed in the API log file
>> that was defined in log4j. But, the log inside the clone mediator is not,
>> it is displayed in the wso2carbon.log.
>>
>> I checked that for ProxyServices even it being inside a clone mediator
>> the logs are written to the proxy service log.
>>
>> Could you assist me on this? Is there any way to have the logs defined in
>> a clone mediator in a api be written to the same log file?
>>
>> Thanks,
>> --
>> Francisco Ribeiro
>> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Milan Perera *| Senior Software Engineer
> WSO2, Inc | lean. enterprise. middleware.
> #20, Palm Grove, Colombo 03, Sri Lanka
> <https://maps.google.com/?q=20,+Palm+Grove,+Colombo+03,+Sri+Lanka&entry=gmail&source=g>
> Mobile: +94 77 309 7088 | Work: +94 11 214 5345
> Email: mi...@wso2.com <ar...@wso2.com> | Web: www.wso2.com
> <http://lk.linkedin.com/in/milanharinduperera>
> <https://wso2.com/signature>
>



-- 
Francisco Ribeiro
*SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to