You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Jmeter Dev <jm...@fastmail.fm> on 2005/02/23 11:51:49 UTC

Adding Log4J to JMeter

After I found out that JMeter does not support Log4J (guys, you can
omit the log4j.conf file. it just confuse us, users), I'm trying to add
this support by mayself.

After importing org.apache.log4j.Logger and writing something like:     
protected static Logger myLog =
Logger.getLogger(MyClass.class.getName());
I'm getting this exception during runtime:
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
	at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)


any ideas?

Thanks.
-- 
  Jmeter Dev
  jmeter_dev_subscribe@fastmail.fm


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


Re: Adding Log4J to JMeter

Posted by sebb <se...@gmail.com>.
On Thu, 24 Feb 2005 02:40:58 -0800, Jmeter Dev
<jm...@fastmail.fm> wrote:
> > You said that you wanted to add log4j support to JMeter.
> >
> > If want the code to be considered for inclusion in a future release of
> > JMeter, it should be done via Commons Logging. Otherwise it's up to
> > you.
> >
> > Commons Logging is already present, so you can write code that uses
> > Commons Logging.
> >
> > Or you can use the existing JMeter logging package.
> >
> > What is it about the the existing logging support that does not meet your
> > needs?
> I'm a little confused, you wrote: 'Commons Logging is already present',

I meant that the Commons Logging *jar* is already present.
It is used by some of the other jars, e.g. HttpClient (I think).

> but you also wrote: 'Migrating to Commons Logging is on my TODO (one
> day) list ...' isn't it a contradiction? if it is already present, how

It's not a contradiction.
Most of JMeter uses LoggingManager, which does not use Commons Logging.

One day I'd like to create a new LoggingManager that uses
CommonsLogging, and then work through all the modules to change to the
new manager (I don't think it's possible to use Commons Logging
without changing the import statements in every module).

> can I use it? through the existing JMeter logging package?

Yes - but you need to call it directly, not through LoggingManager.

> Regarding the existing JMeter logging package, are you talking about the
> LoggingManager? where can it be configure (okay, the logs are written to
> jmeter.log, but what level of logs? debug? warn? error? any others
> configuration?)

See jmeter.properties. 

And the documentation, in particular:
http://jakarta.apache.org/jmeter/usermanual/get-started.html

> You said that I can add Log4J by myself, any idea why After importing
> org.apache.log4j.Logger and writing something like:
> protected static Logger myLog =
> Logger.getLogger(MyClass.class.getName());
> I'm getting this exception during runtime (it compiles, of course):
> java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Unknown Source)

The most likely cause is that the jar is not being found.
Where did you put it?

I see I said to add the jar to the classpath - that's misleading, as
the classpath is ignored when -jar is used. The jar just needs to be
put in one of  the directories JMeter searches, i.e.

lib
or
lib/ext

Best to put it in lib; lib/ext is used for JMeter jars.

>  ???
> >
> > >
> > > On Wed, 23 Feb 2005 12:57:48 +0000, "sebb" <se...@gmail.com> said:
> > > > On Wed, 23 Feb 2005 02:51:49 -0800, Jmeter Dev
> > > > <jm...@fastmail.fm> wrote:
> > > > > After I found out that JMeter does not support Log4J (guys, you can
> > > > > omit the log4j.conf file. it just confuse us, users), I'm trying to add
> > > >
> > > > It is still required, as far as I know. It's just not used in earnest.
> > > > Besides, it we are to add log4j support, it will be needed again.
> > > >
> > > > > this support by mayself.
> > > >
> > > > Why?
> > > >
> > > > If you do want to add log4j support, it should be done via Commons
> > > > Logging, not directly, because then users can actually change the
> > > > logging package very easily.
> > > >
> > > > Migrating to Commons Logging is on my TODO (one day) list ...
> > > >
> > > > Apache HTTPClient uses Commons Logging, so all the jars are present
> > > > anyway.
> > > >
> > > > >
> > > > > After importing org.apache.log4j.Logger and writing something like:
> > > > > protected static Logger myLog =
> > > > > Logger.getLogger(MyClass.class.getName());
> > > > > I'm getting this exception during runtime:
> > > > > java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> > > > >         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
> > > > >         at java.lang.Class.forName0(Native Method)
> > > > >         at java.lang.Class.forName(Unknown Source)
> > > > >
> > > > > any ideas?
> >
> > Try adding log4j to the classpath.
> >
> > > > > Thanks.
> > > > > --
> > > > >   Jmeter Dev
> > > > >   jmeter_dev_subscribe@fastmail.fm
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > > >
> > > --
> > >   Jmeter Dev
> > >   jmeter_dev_subscribe@fastmail.fm
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> >
> --
>   Jmeter Dev
>   jmeter_dev_subscribe@fastmail.fm
> 
>

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


Re: Adding Log4J to JMeter

Posted by Jmeter Dev <jm...@fastmail.fm>.
> You said that you wanted to add log4j support to JMeter.
> 
> If want the code to be considered for inclusion in a future release of
> JMeter, it should be done via Commons Logging. Otherwise it's up to
> you.
> 
> Commons Logging is already present, so you can write code that uses
> Commons Logging.
> 
> Or you can use the existing JMeter logging package.
> 
> What is it about the the existing logging support that does not meet your
> needs?
I'm a little confused, you wrote: 'Commons Logging is already present',
but you also wrote: 'Migrating to Commons Logging is on my TODO (one
day) list ...' isn't it a contradiction? if it is already present, how
can I use it? through the existing JMeter logging package?
Regarding the existing JMeter logging package, are you talking about the
LoggingManager? where can it be configure (okay, the logs are written to
jmeter.log, but what level of logs? debug? warn? error? any others
configuration?)
You said that I can add Log4J by myself, any idea why After importing
org.apache.log4j.Logger and writing something like:     
protected static Logger myLog =
Logger.getLogger(MyClass.class.getName());
I'm getting this exception during runtime (it compiles, of course):
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
 ???
> 
> > 
> > On Wed, 23 Feb 2005 12:57:48 +0000, "sebb" <se...@gmail.com> said:
> > > On Wed, 23 Feb 2005 02:51:49 -0800, Jmeter Dev
> > > <jm...@fastmail.fm> wrote:
> > > > After I found out that JMeter does not support Log4J (guys, you can
> > > > omit the log4j.conf file. it just confuse us, users), I'm trying to add
> > >
> > > It is still required, as far as I know. It's just not used in earnest.
> > > Besides, it we are to add log4j support, it will be needed again.
> > >
> > > > this support by mayself.
> > >
> > > Why?
> > >
> > > If you do want to add log4j support, it should be done via Commons
> > > Logging, not directly, because then users can actually change the
> > > logging package very easily.
> > >
> > > Migrating to Commons Logging is on my TODO (one day) list ...
> > >
> > > Apache HTTPClient uses Commons Logging, so all the jars are present
> > > anyway.
> > >
> > > >
> > > > After importing org.apache.log4j.Logger and writing something like:
> > > > protected static Logger myLog =
> > > > Logger.getLogger(MyClass.class.getName());
> > > > I'm getting this exception during runtime:
> > > > java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> > > >         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
> > > >         at java.lang.Class.forName0(Native Method)
> > > >         at java.lang.Class.forName(Unknown Source)
> > > >
> > > > any ideas?
> 
> Try adding log4j to the classpath.
> 
> > > > Thanks.
> > > > --
> > > >   Jmeter Dev
> > > >   jmeter_dev_subscribe@fastmail.fm
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > >
> > --
> >   Jmeter Dev
> >   jmeter_dev_subscribe@fastmail.fm
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> 
-- 
  Jmeter Dev
  jmeter_dev_subscribe@fastmail.fm


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


Re: Adding Log4J to JMeter

Posted by sebb <se...@gmail.com>.
On Wed, 23 Feb 2005 06:19:05 -0800, Jmeter Dev
<jm...@fastmail.fm> wrote:
> > It is still required, as far as I know. It's just not used in earnest.
> > Besides, it we are to add log4j support, it will be needed again.
> If it will be needed again in the future... why not
> adding it then???
> When the users see 'log4j.conf' they can think that they can just change
> the appenders and it will work...

OK, perhaps we can add a comment to the file.

> > If you do want to add log4j support, it should be done via Commons
> > Logging, not directly, because then users can actually change the
> > logging package very easily.
> >
> > Migrating to Commons Logging is on my TODO (one day) list ...
> Okay...
> If I understand you correctly, the bottom line is that currently, I can
> not log (till you'll add Commons Logging )???

That's not what I meant.

You said that you wanted to add log4j support to JMeter.

If want the code to be considered for inclusion in a future release of
JMeter, it should be done via Commons Logging. Otherwise it's up to
you.

Commons Logging is already present, so you can write code that uses
Commons Logging.

Or you can use the existing JMeter logging package.

What is it about the the existing logging support that does not meet your needs?

> 
> On Wed, 23 Feb 2005 12:57:48 +0000, "sebb" <se...@gmail.com> said:
> > On Wed, 23 Feb 2005 02:51:49 -0800, Jmeter Dev
> > <jm...@fastmail.fm> wrote:
> > > After I found out that JMeter does not support Log4J (guys, you can
> > > omit the log4j.conf file. it just confuse us, users), I'm trying to add
> >
> > It is still required, as far as I know. It's just not used in earnest.
> > Besides, it we are to add log4j support, it will be needed again.
> >
> > > this support by mayself.
> >
> > Why?
> >
> > If you do want to add log4j support, it should be done via Commons
> > Logging, not directly, because then users can actually change the
> > logging package very easily.
> >
> > Migrating to Commons Logging is on my TODO (one day) list ...
> >
> > Apache HTTPClient uses Commons Logging, so all the jars are present
> > anyway.
> >
> > >
> > > After importing org.apache.log4j.Logger and writing something like:
> > > protected static Logger myLog =
> > > Logger.getLogger(MyClass.class.getName());
> > > I'm getting this exception during runtime:
> > > java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> > >         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
> > >         at java.lang.Class.forName0(Native Method)
> > >         at java.lang.Class.forName(Unknown Source)
> > >
> > > any ideas?

Try adding log4j to the classpath.

> > > Thanks.
> > > --
> > >   Jmeter Dev
> > >   jmeter_dev_subscribe@fastmail.fm
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> >
> --
>   Jmeter Dev
>   jmeter_dev_subscribe@fastmail.fm
> 
>

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


Re: Adding Log4J to JMeter

Posted by Jmeter Dev <jm...@fastmail.fm>.
> It is still required, as far as I know. It's just not used in earnest.
> Besides, it we are to add log4j support, it will be needed again.
If it will be needed again in the future... why not
adding it then???
When the users see 'log4j.conf' they can think that they can just change
the appenders and it will work...

> If you do want to add log4j support, it should be done via Commons
> Logging, not directly, because then users can actually change the
> logging package very easily.
> 
> Migrating to Commons Logging is on my TODO (one day) list ...
Okay...
If I understand you correctly, the bottom line is that currently, I can
not log (till you'll add Commons Logging )???


On Wed, 23 Feb 2005 12:57:48 +0000, "sebb" <se...@gmail.com> said:
> On Wed, 23 Feb 2005 02:51:49 -0800, Jmeter Dev
> <jm...@fastmail.fm> wrote:
> > After I found out that JMeter does not support Log4J (guys, you can
> > omit the log4j.conf file. it just confuse us, users), I'm trying to add
> 
> It is still required, as far as I know. It's just not used in earnest.
> Besides, it we are to add log4j support, it will be needed again.
> 
> > this support by mayself.
> 
> Why?
> 
> If you do want to add log4j support, it should be done via Commons
> Logging, not directly, because then users can actually change the
> logging package very easily.
> 
> Migrating to Commons Logging is on my TODO (one day) list ...
> 
> Apache HTTPClient uses Commons Logging, so all the jars are present
> anyway.
> 
> > 
> > After importing org.apache.log4j.Logger and writing something like:
> > protected static Logger myLog =
> > Logger.getLogger(MyClass.class.getName());
> > I'm getting this exception during runtime:
> > java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> >         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
> >         at java.lang.Class.forName0(Native Method)
> >         at java.lang.Class.forName(Unknown Source)
> > 
> > any ideas?
> > Thanks.
> > --
> >   Jmeter Dev
> >   jmeter_dev_subscribe@fastmail.fm
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> 
-- 
  Jmeter Dev
  jmeter_dev_subscribe@fastmail.fm


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


Re: Adding Log4J to JMeter

Posted by sebb <se...@gmail.com>.
On Wed, 23 Feb 2005 02:51:49 -0800, Jmeter Dev
<jm...@fastmail.fm> wrote:
> After I found out that JMeter does not support Log4J (guys, you can
> omit the log4j.conf file. it just confuse us, users), I'm trying to add

It is still required, as far as I know. It's just not used in earnest.
Besides, it we are to add log4j support, it will be needed again.

> this support by mayself.

Why?

If you do want to add log4j support, it should be done via Commons
Logging, not directly, because then users can actually change the
logging package very easily.

Migrating to Commons Logging is on my TODO (one day) list ...

Apache HTTPClient uses Commons Logging, so all the jars are present anyway.

> 
> After importing org.apache.log4j.Logger and writing something like:
> protected static Logger myLog =
> Logger.getLogger(MyClass.class.getName());
> I'm getting this exception during runtime:
> java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>         at expansion.extractor.MyClass.<clinit>(MyClass.java:25)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Unknown Source)
> 
> any ideas?
> Thanks.
> --
>   Jmeter Dev
>   jmeter_dev_subscribe@fastmail.fm
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> 
>

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