Also, you should consider writing a unit test to test this. This article explains how you can examine the log output to verify that it contains the expected string: http://stackoverflow.com/questions/3717402/how-to-test-w-junit-that-warning -was-logged-w-log4j
Of course you have the additional problem that it is a protected method, but there are solutions to that. -- Chiradeep On 7/13/12 11:30 AM, "Chiradeep Vittal" <chiradeep.vit...@citrix.com> wrote: >I think you should re-consider the way this log is handled: >1. If the cluster only contains non-HVM hosts, then this is going to be a >very large log string. >2. The log does not contain any context: if there are a 100 concurrent >deployment requests active: which one does this apply to? There is the >job-id of course, but say the cluster name would be useful for immediate >grokking >3. It seems to me that just the count of non-HVM hosts is useful: if you >consider that tens of thousands of vms will be deployed, this same verbose >log with the exact same info will be printed thousands of times. So, why >not just a counter instead of an expensive list? > >On 7/12/12 11:58 PM, "Nitin Mehta" <nitin.me...@citrix.com> wrote: > >> >>----------------------------------------------------------- >>This is an automatically generated e-mail. To reply, visit: >>https://reviews.apache.org/r/5927/#review9131 >>----------------------------------------------------------- >> >>Ship it! >> >> >>Ship It! >> >>- Nitin Mehta >> >> >>On July 13, 2012, 6:46 a.m., Prasanna Santhanam wrote: >>> >>> ----------------------------------------------------------- >>> This is an automatically generated e-mail. To reply, visit: >>> https://reviews.apache.org/r/5927/ >>> ----------------------------------------------------------- >>> >>> (Updated July 13, 2012, 6:46 a.m.) >>> >>> >>> Review request for cloudstack, Prachi Damle and Nitin Mehta. >>> >>> >>> Description >>> ------- >>> >>> CS-15560 : Improve HVM logging of hosts >>> >>> When a host is not considered for deployment because it has disabled >>>HVM, then call that out in the logs for debugging. >>> >>> >>> This addresses bug CS-15560. >>> >>> >>> Diffs >>> ----- >>> >>> >>>server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java >>>0f163cc >>> >>> Diff: https://reviews.apache.org/r/5927/diff/ >>> >>> >>> Testing >>> ------- >>> >>> 1) Deployed a Simulator Environment with two Simulator hosts >>> 2) marked a host as non-HVM and template as HVM enabled >>> * update host set capabilities=NULL where id=1; >>> * update vm_template set hvm=1 where id=10; >>> 3) restart MS for the VOs to refresh >>> 4) deploy VM using the template >>> 5) Verified the non-HVM hosts are called out in the logs >>> >>> Logs shown as below: >>> 2012-07-13 12:07:58,904 DEBUG [allocator.impl.FirstFitAllocator] >>>(Job-Executor-9:job-30 FirstFitRoutingAllocator) Not considering hosts: >>>[Host[-1-Routing]] to deploy template: Tmpl[10-VHD-simulator-Centos as >>>they are not HVM enabled >>> >>> >>> Thanks, >>> >>> Prasanna Santhanam >>> >>> >> >