locked
Questions about how to generate error logging for tabs. RRS feed

  • Question

  • User662762443 posted

    I have problem in the following situation below: I need to generate error log if at the time of generating the guides the system does not fill the barcode field. This is my code:

    protected void btnCreate_Click (object sender, EventArgs e)
            {
    
    		
    		if (returnXML.Contains ("<XML>"))
                                    {
                                        returnXML = returnXML.Replace ("&", "& amp;");
                                        XmlDocument xmlDoc = new XmlDocument ();
                                        xmlDoc.LoadXml (returnXML);
    
              
                                         item.CodBars = xmlDoc.SelectSingleNode ("XML"). ChildNodes [6] .InnerText;
    				      
    				      if (string.IsNullOrEmpty(item.CodBars) || !(Regex.IsMatch(item.CodBars.Trim(), @"^\d+$")) || Regex.IsMatch(item.CodBars, "[Erro]"))
                                           {
                                            this.fillsError(item, "Barcode error.");
                                            continue;
                                           }
                                     }
                                     else
                                    {
                                        this.fillsError(item, returnXML);
                                    }
             }

    Tuesday, December 18, 2018 12:53 PM

Answers

  • User475983607 posted

    rtaVix

    mgebhard, I listened to the rest of the code so that it would not be such a big topic, I only posted logic that is related to the barcode. Regarding this colleague who started to do it, he just left me in the hand with regard to my work, I'm doing the part of him or better trying. But focusing on the subject could you give me an example of how I could log this using your explanation since what I provided does not help you? Could you give me that support?

    It looks like there is a logging attempt here...

    this.fillsError(item, "Barcode error.");

    ... but that's a guess as we cannot see the code.

    My best advice is using the Visual Studio debugger to single stepping through the code since you are unable to speak with the developer that wrote the code.  The code shown makes little sense so it is difficult to provide assistance. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2018 2:59 PM

All replies

  • User475983607 posted

    The code and question are unclear.  There are several variables that are defined elsewhere, there is no indication what a "tab" is, there is no indication what an error is, there is no indication how logging works in you application, the continue statement is used in loops but there's no loop.  

    Given your other thread, I recommend that you meet with your colleague and ask for assistance with the code and the business requirements.  

    Tuesday, December 18, 2018 2:17 PM
  • User662762443 posted

    mgebhard, I listened to the rest of the code so that it would not be such a big topic, I only posted logic that is related to the barcode. Regarding this colleague who started to do it, he just left me in the hand with regard to my work, I'm doing the part of him or better trying. But focusing on the subject could you give me an example of how I could log this using your explanation since what I provided does not help you? Could you give me that support?

    Tuesday, December 18, 2018 2:47 PM
  • User475983607 posted

    rtaVix

    mgebhard, I listened to the rest of the code so that it would not be such a big topic, I only posted logic that is related to the barcode. Regarding this colleague who started to do it, he just left me in the hand with regard to my work, I'm doing the part of him or better trying. But focusing on the subject could you give me an example of how I could log this using your explanation since what I provided does not help you? Could you give me that support?

    It looks like there is a logging attempt here...

    this.fillsError(item, "Barcode error.");

    ... but that's a guess as we cannot see the code.

    My best advice is using the Visual Studio debugger to single stepping through the code since you are unable to speak with the developer that wrote the code.  The code shown makes little sense so it is difficult to provide assistance. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2018 2:59 PM