You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Wido den Hollander <wi...@widodh.nl> on 2012/08/01 19:18:40 UTC

Re: Review Request: Do not log null lines in agent logfile

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/6287/
-----------------------------------------------------------

(Updated Aug. 1, 2012, 5:18 p.m.)


Review request for cloudstack.


Summary (updated)
-----------------

Do not log null lines in agent logfile


Description
-------

Do not fill the agent log with a lot of "null" lines.

Not every command has a request and response, but we do log them.

This causes a lot of log lines like:

DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Request:null
DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Processing command: com.cloud.agent.api.GetStorageStatsCommand
DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) null

By checking if the toString() method actually returns something we can prevent logging empty lines.

I just want to make sure I'm not missing something here, since bad logging would make it hard for end-users to debug problems.


Diffs
-----

  agent/src/com/cloud/agent/Agent.java babf0b3 

Diff: https://reviews.apache.org/r/6287/diff/


Testing
-------


Thanks,

Wido den Hollander


Re: Review Request: Do not log null lines in agent logfile

Posted by edison su <ed...@citrix.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/6287/#review11418
-----------------------------------------------------------

Ship it!


It's already checked in, for a long time.

- edison su


On Aug. 1, 2012, 5:18 p.m., Wido den Hollander wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/6287/
> -----------------------------------------------------------
> 
> (Updated Aug. 1, 2012, 5:18 p.m.)
> 
> 
> Review request for cloudstack.
> 
> 
> Description
> -------
> 
> Do not fill the agent log with a lot of "null" lines.
> 
> Not every command has a request and response, but we do log them.
> 
> This causes a lot of log lines like:
> 
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Request:null
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Processing command: com.cloud.agent.api.GetStorageStatsCommand
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) null
> 
> By checking if the toString() method actually returns something we can prevent logging empty lines.
> 
> I just want to make sure I'm not missing something here, since bad logging would make it hard for end-users to debug problems.
> 
> 
> Diffs
> -----
> 
>   agent/src/com/cloud/agent/Agent.java babf0b3 
> 
> Diff: https://reviews.apache.org/r/6287/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Wido den Hollander
> 
>


Re: Review Request: Do not log null lines in agent logfile

Posted by Wido den Hollander <wi...@widodh.nl>.

> On Aug. 1, 2012, 10:26 p.m., edison su wrote:
> > The request o response is null, is not because they are null, it's because, the loglevel set on the command class or member of command class. Take GetHostStatsCommand as an example, it has set loglevel as @LogLevel(Log4jLevel.Trace), so unless the loglevel is set to Trace in log4j, the request.tostring returns null. I add a fix.

I see that you implement something like I suggested.

I still my agent logging "null" responses however:

2012-08-02 01:32:36,090 DEBUG [cloud.agent.Agent] (agentRequest-Handler-3:null) Processing command: com.cloud.agent.api.GetStorageStatsCommand
2012-08-02 01:32:37,378 DEBUG [cloud.agent.Agent] (agentRequest-Handler-3:null) null
2012-08-02 01:32:51,258 DEBUG [cloud.agent.Agent] (agentRequest-Handler-4:null) Processing command: com.cloud.agent.api.GetVmStatsCommand
2012-08-02 01:32:51,303 DEBUG [cloud.agent.Agent] (agentRequest-Handler-4:null) null

Shouldn't we do the same for the responses?


- Wido


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/6287/#review9726
-----------------------------------------------------------


On Aug. 1, 2012, 5:18 p.m., Wido den Hollander wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/6287/
> -----------------------------------------------------------
> 
> (Updated Aug. 1, 2012, 5:18 p.m.)
> 
> 
> Review request for cloudstack.
> 
> 
> Description
> -------
> 
> Do not fill the agent log with a lot of "null" lines.
> 
> Not every command has a request and response, but we do log them.
> 
> This causes a lot of log lines like:
> 
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Request:null
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Processing command: com.cloud.agent.api.GetStorageStatsCommand
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) null
> 
> By checking if the toString() method actually returns something we can prevent logging empty lines.
> 
> I just want to make sure I'm not missing something here, since bad logging would make it hard for end-users to debug problems.
> 
> 
> Diffs
> -----
> 
>   agent/src/com/cloud/agent/Agent.java babf0b3 
> 
> Diff: https://reviews.apache.org/r/6287/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Wido den Hollander
> 
>


Re: Review Request: Do not log null lines in agent logfile

Posted by edison su <ed...@citrix.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/6287/#review9726
-----------------------------------------------------------


The request o response is null, is not because they are null, it's because, the loglevel set on the command class or member of command class. Take GetHostStatsCommand as an example, it has set loglevel as @LogLevel(Log4jLevel.Trace), so unless the loglevel is set to Trace in log4j, the request.tostring returns null. I add a fix.

- edison su


On Aug. 1, 2012, 5:18 p.m., Wido den Hollander wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/6287/
> -----------------------------------------------------------
> 
> (Updated Aug. 1, 2012, 5:18 p.m.)
> 
> 
> Review request for cloudstack.
> 
> 
> Description
> -------
> 
> Do not fill the agent log with a lot of "null" lines.
> 
> Not every command has a request and response, but we do log them.
> 
> This causes a lot of log lines like:
> 
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Request:null
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) Processing command: com.cloud.agent.api.GetStorageStatsCommand
> DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:null) null
> 
> By checking if the toString() method actually returns something we can prevent logging empty lines.
> 
> I just want to make sure I'm not missing something here, since bad logging would make it hard for end-users to debug problems.
> 
> 
> Diffs
> -----
> 
>   agent/src/com/cloud/agent/Agent.java babf0b3 
> 
> Diff: https://reviews.apache.org/r/6287/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Wido den Hollander
> 
>