On 27 June 2015 at 16:16, Philippe Mouawad <[email protected]> wrote:
> I also do but it is more performance consuming and can flood a test logs in
> some cases.
>
> No general guide line AFAIK.

There is one convention we use, which is that debug messages should be
protected by a check of isDebugEnabled if the message is possibly
expensive to create.
I.e. not necessary for plain strings, but should generally be used for
run-time string concatenation and method calls.

In the case of warnings and errors, it's important that sufficient
information is logged in order to understand the message.
Whether a stack trace is needed depends on the circumstances, but
probably better to provide one than not, as it may be difficult to
reproduce the test conditions that generated the errro.

> On Sat, Jun 27, 2015 at 4:52 PM, Felix Schumacher <
> [email protected]> wrote:
>
>>
>>
>> Am 27. Juni 2015 16:06:54 MESZ, schrieb [email protected]:
>> >Author: pmouawad
>> >Date: Sat Jun 27 14:06:54 2015
>> >New Revision: 1687926
>> >
>> >URL: http://svn.apache.org/r1687926
>> >Log:
>> >Add more infos on errors
>> >
>> >Modified:
>> >jmeter/trunk/src/components/org/apache/jmeter/extractor/HtmlExtractor.java
>> >
>> >Modified:
>> >jmeter/trunk/src/components/org/apache/jmeter/extractor/HtmlExtractor.java
>> >URL:
>> >
>> http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/HtmlExtractor.java?rev=1687926&r1=1687925&r2=1687926&view=diff
>>
>> >==============================================================================
>> >---
>> >jmeter/trunk/src/components/org/apache/jmeter/extractor/HtmlExtractor.java
>> >(original)
>> >+++
>> >jmeter/trunk/src/components/org/apache/jmeter/extractor/HtmlExtractor.java
>> >Sat Jun 27 14:06:54 2015
>> >@@ -91,7 +91,7 @@ public class HtmlExtractor extends Abstr
>> >         if (previousResult == null) {
>> >             return;
>> >         }
>> >-        log.debug("HtmlExtractor processing result");
>> >+        log.debug("HtmlExtractor "+getName()+":processing result");
>> >
>> >         // Fetch some variables
>> >         JMeterVariables vars = context.getVariables();
>> >@@ -116,7 +116,7 @@ public class HtmlExtractor extends Abstr
>> >                 try {
>> >                     prevCount = Integer.parseInt(prevString);
>> >                 } catch (NumberFormatException e1) {
>> >-                    log.warn("Could not parse "+prevString+" "+e1);
>> >+                    log.warn(getName()+":Could not parse
>> >"+prevString+" "+e1);
>>
>> I prefer to get a stacktrace instead of a simple String of the error.
>>
>> Do we have a general guide line with respect to this?
>>
>> Regards,
>> Felix
>> >                 }
>> >             }
>> >          int matchCount=0;// Number of refName_n variable sets to keep
>> >@@ -145,11 +145,11 @@ public class HtmlExtractor extends Abstr
>> >                     vars.remove(refName_n);
>> >                 }
>> >             } catch (RuntimeException e) {
>> >-                log.warn("Error while generating result");
>> >+                log.warn(getName()+":Error while generating result");
>> >             }
>> >
>> >         } catch (RuntimeException e) {
>> >-            log.warn("Error while generating result");
>> >+            log.warn(getName()+":Error while generating result");
>> >         }
>> >
>> >     }
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Reply via email to