RestClient logs too much and too few

ett

Member
The outputs of RestClient too much. However, when the log level is set to WARN or higher, there are too few logs.
Here is my suggestion.
- "02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 content -> ..."
should be INFO as-is.
- Both "02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 SEND REST OBJECT ==>"
and "02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 RECEIVED REST OBJECT <=="
should be DEBUG because these are just pretty the content.
Please consider it.
 

Max

Administrator
Staff member
Good day.
Just add the following line to /usr/local/FlashphonerWebCallServer/conf/log4j.properties file:
Code:
log4j.logger.RestClient=warn
This will reduce RestClient class logging without server restart.
 

ett

Member
It make too few logs, unable to log "nodeId", "sessionId", "payload", and so on.
Please read what I said carefully.

I did workaround using the filter function of log4j like this.
Code:
log4j.logger.RestClient=INFO
log4j.appender.fAppender.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.fAppender.filter.1.StringToMatch=REST OBJECT
log4j.appender.fAppender.filter.1.AcceptOnMatch=false
It logs only the line "02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 content -> ...",
but not logs "SEND|RECEIVED REST OBJECT" as expected.

However, I still think that the "SEND|RECEIVED REST OBJECT" which is *JUST A PRETTY PRINT* should be DEBUG level.
Thank you.
 
Last edited:

Max

Administrator
Staff member
However, I still think that the "SEND|RECEIVED REST OBJECT" which is *JUST A PRETTY PRINT* should be DEBUG level.
This messages are useful for us to investigate a various publishing/playback issues in customets logs. So we will not move them to debug levele because not all the customers are familiar with log4j.properties format.
You can use the workaround if you don't need this logs.
 

ett

Member
I know that the message is useful.
What I am saying is that the same data appears in this "content" line.
"02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 content -> ..."

A bit of messy pseudo code,
Currently,
Code:
console.info("SEND REST OBJECT ==>", ObjectToMultiLineHumanReadable(data));
console.info("content ->", ObjectToOneLine(data));
console.info("RECEIVED REST OBJECT <==", ObjectToMultiLineHumanReadable(data));
my suggestion,
Code:
console.debug("SEND REST OBJECT ==>", ObjectToMultiLineHumanReadable(data));
console.info("content ->", ObjectToOneLine(data));
console.debug("RECEIVED REST OBJECT <==", ObjectToMultiLineHumanReadable(data));
 

Max

Administrator
Staff member
What I am saying is that the same data appears in this "content" line.
"02:59:37,329 INFO RestClient - API-ASYNC-pool-13-thread-1 content -> ..."
This messages show how REST hooks work on WCS side.
SEND REST OBJECT shows a query which will be sent to a backend.
RECEIVED REST OBJECT shows a response from the backend.
They may not be the same depending on backend implementation. In your case, internal WCS backend is used, that's why request and response are the same. We may receive just OK for example from customers backend (and it may be wrong response and a possible reason to [ublishing or playback failure).
 

ett

Member
I understand what you are trying to say.
"SEND REST OBJECT", "content" and "RECEIVED REST OBJECT" are 3 different pieces of data, right?
But why are only 2 pieces of data being Pretty Printed? The pretty printed is difficult to investigate.

In fact, I extracted "content" line and used "jq" to get the output I wanted to investigate.
I did not use the "(SEND|RECEIVED) REST OBJECT" output because I could not do parse using "jq".

However, if you continue to output these 3 data at the INFO level,
please do not change the current behavior,
as I would like to continue using log4j workaround.

Thank you for answering and please close this thread.
 
Top