adobe / log-parser

An SDK and Tool that allows you to analyse, sort, filter, and search your logs. The added value is that all data is stored in Java objects that can be used for other purposes such as: assertions, reporting, automated decision making.
MIT License
18 stars 8 forks source link

Fix the structure issue on the json file extracted by the exportLogDataToJSON method #189

Closed mickaelgobbo closed 3 days ago

mickaelgobbo commented 3 days ago

Expected Behaviour

As an expected behavior, we expect to have a json with a right structure, file extracted from the exportLogDataToJSON methods.

Actual Behaviour

Currently, the json file structure is not good.

Steps to Reproduce

contact me in direct if you want an example of the extraction from our log projects. i have a CI job extracting on the fly a json object from the exportLogDataToJSON method.

Sample extracted file that illustrates the problem

As an example of the json extraction we have:

"[ {\n \"fileName\" : \"aaa.log\",\n \"code\" : \"ODB-aaaaa\",\n \"test\" : \"aaaaa\",\n \"testSuite\" : \"aaaa\",\n \"topology\" : \"aaaaaa\",\n \"timing\" : \"aaaaa\",\n \"errorMessage\" : \"aaaaaa\",\n \"className\" : \"Provisioning\",\n \"thread\" : \"aaaaaa\",\n \"testStatus\" : \"N/A\",\n \"frequence\" : \"1\",\n \"deployment\" : \"2594\",\n \"timestamp\" : \"2024-10-01T11:40:22.977Z\"\n}, {\n \"fileName\" : \"aaaa.log\",\n \"code\" : \"aaaaaa\",\n \"test\" : \"aaaa\",\n \"testSuite\" : \"Standard\",\n \"topology\" : \"transfer_control\",\n \"timing\" : \"during_tests\",\n \"errorMessage\" : \"aaaaaaaaaaa",\n \"className\" : \"aaaaaaaa\",\n \"thread\" : \"aaaaa\",\n \"testStatus\" : \"PASS\",\n \"frequence\" : \"1\",\n \"deployment\" : \"2594\",\n \"timestamp\" : \"2024-10-01T12:04:56.673Z\"\n} ]"

Proposition of fixes.

To have a good one, the bellow adaptation on the extraction have to be done:

Remove the CRLF : remove the \r\n (windows extraction) or remove the \n (linux extraction) remove the backslash should start by [{ instead of "[{ should end by }] instead of }]"

tested in local and by applying the above fixes, the structure is good.