You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Cameron Taggart <ct...@u.washington.edu> on 2004/02/25 04:00:19 UTC

customer SampleListener

Following the directions at 
http://jakarta.apache.org/jmeter/extending/#listener, I've created my 
own class named LoggingSampleListner which implement SampleListener.  
For now, I just want the listener to log out some info via Log4J.  I 
compiled the class, put it in a jar and put the lib\etc directory.  What 
else must I do to enable this very basic listener?

Thanks,
Cameron

  private static final Logger logger = Logger.getLogger( 
LoggingSampleListener.class );

  public void sampleOccurred( SampleEvent e ) {
    SampleResult r = e.getResult(  );
    byte[]       b = r.getResponseData(  );
    logger.info( "sampleOccured(), " + new String( b ) );
    System.out.println( "sampleOccured()");
  }

  public void sampleStarted( SampleEvent e ) {
    logger.info( "sampleStarted() ");
    System.out.println( "sampleStarted()");
  }

  public void sampleStopped( SampleEvent e ) {
    logger.info( "sampleStopped() ");
    System.out.println( "sampleStopped()");
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: customer SampleListener

Posted by Jordi Salvat i Alabart <js...@atg.com>.
Implement SampleListener. And create a GUI for it. The later is a pain, 
so if you're using the latest code from CVS or a recent nightly, you may 
want to try the new TestBean feature: just have your SampleListener 
extend TestBean and JMeter will automagically create a GUI for it.

Let me know how you fare with this TestBean thing.

-- 
Salut,

Jordi.

Cameron Taggart wrote:
> Following the directions at 
> http://jakarta.apache.org/jmeter/extending/#listener, I've created my 
> own class named LoggingSampleListner which implement SampleListener.  
> For now, I just want the listener to log out some info via Log4J.  I 
> compiled the class, put it in a jar and put the lib\etc directory.  What 
> else must I do to enable this very basic listener?
> 
> Thanks,
> Cameron
> 
>  private static final Logger logger = Logger.getLogger( 
> LoggingSampleListener.class );
> 
>  public void sampleOccurred( SampleEvent e ) {
>    SampleResult r = e.getResult(  );
>    byte[]       b = r.getResponseData(  );
>    logger.info( "sampleOccured(), " + new String( b ) );
>    System.out.println( "sampleOccured()");
>  }
> 
>  public void sampleStarted( SampleEvent e ) {
>    logger.info( "sampleStarted() ");
>    System.out.println( "sampleStarted()");
>  }
> 
>  public void sampleStopped( SampleEvent e ) {
>    logger.info( "sampleStopped() ");
>    System.out.println( "sampleStopped()");
>  }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org