CloudWatchAppender
CloudWatchAppender copied to clipboard
Cloud watch with log4net API
Hi,
I am trying to integrate log4net API to push all application logs directly to Cloud watch. This is working fine. But message in json format is truncated. I am trying to log API request and response content. My API is using following JSON format for request/response.
{ "Name": "SyncAPI", "Message": { "LastSyncNo": 100 }, "Status": { "Success": false, "Code": 422 } }
Following layout pattern is used in log4net configuration. Could you please help me to log data in above mentioned JSON format using log4net?
<layout type="AWSAppender.Core.Layout.PatternLayout, AWSAppender.Core"> <conversionPattern value="%date [%thread] %-5level %message" /> </layout>
Regards,
Princy
Hi!
Sorry for the late response.
The LogsAppender will attempt to parse the json, and in doing so recognizes certain keywords, among them Message. This is where it expects the main message to be.
The parser is not particularly good so it get's confused reading the above.
It should be possible to escape the json as in for example
{Message:\"{\"Name\": \"SyncAPI\",\"Message\": {\"LastSyncNo\": 100},\"Status\": {\"Success\": false,\"Code\": 422}}}\""
Sadly, this does not work, so this is a proper bug.
The work around in the meantime is to replace Message with Message_ or some such.
Ok, Thanks for the information.
Hi I would like work on the above issue and contribute my solution to the problem .Please provide me with the necessary requirements so that I will start working on it. Since it is mandatory for my course requirement I assure you for the completion of the issue.