#2510 dump CIM xml by LogAndTraceBroker.trace()

New_Feature
closed-fixed
Dave Blaschke
5
2012-09-14
2012-08-06
chen wang
No

Now we have to modify sblim-cim-client2.properties and reload the properties file so that we can dump CIM xml to a specific log file.
I check current code. Most of the logs by LogAndTraceBroker.trace() is of Level.FINER.
Is it possible that we can dump CIM xml by LogAndTraceBroker.trace() with Level.FINEST? Thus we can enable CIM xml logs by adjust the logger level without reloading the properties file.

Discussion

  • Dave Blaschke
    Dave Blaschke
    2012-08-06

    • assigned_to: nobody --> blaschke-oss
     
  • Dave Blaschke
    Dave Blaschke
    2012-08-07

    Why do you have to modify the properties file to enable CIM-XML tracing? The following code should work:

    System.setProperty("sblim.wbem.cimxmlTracing", "true");
    LogAndTraceBroker.getBroker().setXmlTraceStream(DirectorLogStream);

    As for the proposed solution, I am not a fan of sending CIM-XML requests and responses to all trace listeners at Level.FINEST. That level is used for debugging purposes only - TRC.debug() and API entry/exits. Adding a LOT more trace data to the level could confuse/break other applications.

    My suggestion, as coded in the attached proposed patch, is to create a new CIM-XMLTraceListener that is only called with complete CIM-XML requests and responses. When you want to start tracing CIM-XML, simply call addCIMXMLTraceListener(). When done, call removeCIMXMLTraceListener(). This solution has the added benefit of being called only with a CIM-XML request/response, as opposed to checking if the Level is FINEST, then checking if the first line contains "request" or "response" before knowing if you have a CIM-XML request or response.

    Please provide feedback.

     
  • Dave Blaschke
    Dave Blaschke
    2012-08-07

    Proposed patch

     
    Attachments
  • chen wang
    chen wang
    2012-08-08

    The bug is opened to cover situation like this. In customer environment, something wrong happens and we would have to get cim xml trace to debug the issue. As we know, it is not possible to restart customer's environment or modify some code to patch the environment. So these are good but not acceptable in customer site. The reasonalbe option I can see is to enable logs by set log level or set log id. Thanks.

    System.setProperty("sblim.wbem.cimxmlTracing", "true");
    LogAndTraceBroker.getBroker().setXmlTraceStream(DirectorLogStream);
    addCIMXMLTraceListener()/ removeCIMXMLTraceListener()

     
  • Dave Blaschke
    Dave Blaschke
    2012-08-08

    So if it is not possible to restart customer environment or modify code to patch environment, then it sounds like Director will have to always trace CIM-XML. And if it always has to trace CIM-XML, then it can just enable tracing when it starts up. It can do this is one of three ways:

    1) During initialization, call:
    System.setProperty("sblim.wbem.cimxmlTracing", "true");
    LogAndTraceBroker.getBroker().setXmlTraceStream(DirectorLogStream);
    ALREADY EXISTS

    2) During initialization, call:
    LogAndTraceBroker.getBroker().addTraceListener(DirectorListener);
    USE YOUR PROPOSED PATCH AND PARSE CIM-XML OUT OF TRACE

    3) During initialization, call:
    LogAndTraceBroker.getBroker().addCIMXMLTraceListener(DirectorListener);
    USE ATTACHED PROPOSED PATCH

    Also, I am not sure what you mean by "The reasonalbe option I can see is to enable logs by set log level or set log id." Both require changing the customer environment on the fly, which I thought couldn't be done.

     
  • Dave Blaschke
    Dave Blaschke
    2012-08-17

    Patch sent for community review. During a 2 week period any
    exploiter may comment on the patch, request changes or turn it
    down completely (with good reason). For the time being the patch is part of the "Experimental" branch in CVS.

     
  • Dave Blaschke
    Dave Blaschke
    2012-08-17

    • status: open --> open-fixed
     
  • Dave Blaschke
    Dave Blaschke
    2012-08-23

    Update from submitter:

    I've integrated the patch into ISD and it dumps CIM XML successfully.
    But we have one issue here.
    Below is the code for sblim trace logger we already have in ISD. As we see in the code, pLevel is needed here, because
    1. in sblim perspective, it should decides the logger level. For example, if something wrong happens in http request/response, it should log the XML with level warning so that ISD will print it by default();
    and when we need the XML dumped to debug other issue, they need be printed with level fine/finer/finest.
    2. as we know, XML can always be a big string variable. With pLevel, we could wrap the logger code in if (sblimLogger.isLoggable(pLevel)) {}. Thus it would save both time and space when it do not need to handle it.

    But currently, the interface is public void traceCIMXML(String pMessage, boolean pOutgoing);

     
  • Dave Blaschke
    Dave Blaschke
    2012-08-23

    Will add Level parameter to appropriate methods, although at this point only FINEST will be used

     
  • Dave Blaschke
    Dave Blaschke
    2012-09-06

    Patch against HEAD

     
    Attachments
  • Dave Blaschke
    Dave Blaschke
    2012-09-06

    The community review has completed and we received no substantial criticism. Therefore the patch has been approved and merged into the "HEAD" branch. The next release will pick it up.

     
  • Dave Blaschke
    Dave Blaschke
    2012-09-06

    • status: open-fixed --> pending-fixed
     
  • Dave Blaschke
    Dave Blaschke
    2012-09-06

    Patch applied to 2.1.12

     
  • Dave Blaschke
    Dave Blaschke
    2012-09-14

    • status: pending-fixed --> closed-fixed
     
  • Dave Blaschke
    Dave Blaschke
    2012-09-14

    The patch was picked up by release 2.2.0 and will therefore be closed.