On 22-08-2016 15:36, Aline Manera wrote:
On 08/22/2016 02:56 PM, Lucio Correia wrote:
> On 22-08-2016 11:05, Aline Manera wrote:
>>
>>
>> On 08/09/2016 11:42 AM, Lucio Correia wrote:
>>> * Add info needed for translation to user request log
>>> entries (without unsafe parameters like passwwords)
>>> * Log message untranslated to base file (wok-req.log).
>>> * Keep compatibility to prior format of base log file,
>>> which does not have needed information to do translation.
>>
>>> Old log entry format:
>>> [logrecord] >>> [translated message]
>>
>>
>>> New log entry format:
>>> [logrecord] >>> [message params] >>> [untranslated
message]
>>
>> Why don't include the message params to the JSON?
>
> That's because [logrecord] is the dict with all key=values passed to
> the request, and we should not mix the parameters to the error message
> there, because it can overwrite a request parameter (independently of
> key name I choose).
I am not sure I got your point.
Why can't we add the params to the JSON?
For example:
error: {code: XXX, params: {<msg params>}}
Because if the request has a parameter 'error' (even passed by mistake
or malicious intention) it would be overwritten.
We cannot guarantee that, that's why it's separated.
>
>> Why do we need to have the untranslated message there? This log file is
>> only used as input for the user log activity feature. It is not done to
>> be read as debug or so. For debug, we have the official logs under
>> /var/log/wok.
>
> We don't need it, but why not?
>
> Since the beginning, I've designed it to be also a log file, with
> useful info (JSON was chosen because of that).
>
> Remember that prior versions wok-req.log files contain the translated
> message there. Now that this has changed, I decided to keep its
> English version.
>
> Let me know if you want a patch to remove it.
>
Yeap! I'd say to remove it and make it a pure JSON file. So we identify
it as an input file for a feature.
It cannot be a pure JSON file due to problem above.