Log4j appender plugins when running JMeter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Log4j appender plugins when running JMeter

Andrew Burton
Hi list,

I'm using the Sumo Log4j2 appender plugin (
https://github.com/SumoLogic/sumologic-log4j2-appender) which pushes logs
directly to Sumo via HTTP.

The plugin works fine when adding the JAR to JMeter's lib/ext directory
(and a dependency HTTP JAR to lib).

However I keep all my JARs in a separate lib and lib/ext directory which
are specified at runtime using
-Jplugin_dependency_paths=%TEST_HOME%/resources/lib
and -Jsearch_paths=%TEST_HOME%/resources/lib/ext. In this situation, the
JARs aren't found and an exception is thrown by log4j. All other JARs are
loaded by JMeter without issue.

The log4j config file is loaded through JVM_ARGs:
JVM_ARGS=-Dlog4j.configurationFile=file://%TEST_HOME%/conf/log4j2.xml

I've tried setting -Juser.classpath, without success.

Are there any other considerations when adding extra JARs for use in log4j
that people have come across?

Thanks

Andrew
pmd
Reply | Threaded
Open this post in threaded view
|

Re: Log4j appender plugins when running JMeter

pmd
I guess you’re on windows from the %.

Add a Non Test elements > Property display element and check that what is
passed is correct.

Do you have any warn message in logs or on console ?

Thanks

On Friday, March 22, 2019, Andrew Burton <[hidden email]> wrote:

> Hi list,
>
> I'm using the Sumo Log4j2 appender plugin (
> https://github.com/SumoLogic/sumologic-log4j2-appender) which pushes logs
> directly to Sumo via HTTP.
>
> The plugin works fine when adding the JAR to JMeter's lib/ext directory
> (and a dependency HTTP JAR to lib).
>
> However I keep all my JARs in a separate lib and lib/ext directory which
> are specified at runtime using
> -Jplugin_dependency_paths=%TEST_HOME%/resources/lib
> and -Jsearch_paths=%TEST_HOME%/resources/lib/ext. In this situation, the
> JARs aren't found and an exception is thrown by log4j. All other JARs are
> loaded by JMeter without issue.
>
> The log4j config file is loaded through JVM_ARGs:
> JVM_ARGS=-Dlog4j.configurationFile=file://%TEST_HOME%/conf/log4j2.xml
>
> I've tried setting -Juser.classpath, without success.
>
> Are there any other considerations when adding extra JARs for use in log4j
> that people have come across?
>
> Thanks
>
> Andrew
>


--
Cordialement.
Philippe Mouawad.
Reply | Threaded
Open this post in threaded view
|

Re: Log4j appender plugins when running JMeter

Andrew Burton
Hi Phillipe,

Here is the debugging I've tried so far. First, setting the JVM_ARGS to
point to the log4j2 config file
C:\Projects\Software\apache-jmeter-5.0\bin>set
JVM_ARGS="-Dlog4j.configurationFile=file://c:/projects/perftest/src/test/conf/log4j2.xml"

Starting JMeter, the following errors are displayed:
C:\Projects\Software\apache-jmeter-5.0\bin>jmeter.bat
2019-03-26 09:35:27,564 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:35:27,571 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:35:27,573 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:35:27,753 main ERROR Unable to locate appender
"SumoJmeterLogAppender" for logger config "root"
2019-03-26 09:35:27,757 main ERROR Unable to locate appender
"SumoJmeterRunlogAppender" for logger config
"org.apache.jmeter.modifiers.JSR223PreProcessor"
2019-03-26 09:35:27,759 main ERROR Unable to locate appender
"SumoJmeterRunlogAppender" for logger config "JmeterRunLogger"

Specifying path to the dirs the JARs are in does not help either:
C:\Projects\Software\apache-jmeter-5.0\bin>jmeter.bat
-Jplugin_dependency_paths=c:/projects/perftest/src/test/resources/lib
-Jsearch_paths=c:/projects/perftest/src/test/resources/lib/ext
2019-03-26 09:38:21,288 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:38:21,295 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:38:21,298 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:38:21,465 main ERROR Unable to locate appender
"SumoJmeterLogAppender" for logger config "root"
2019-03-26 09:38:21,469 main ERROR Unable to locate appender
"SumoJmeterRunlogAppender" for logger config
"org.apache.jmeter.modifiers.JSR223PreProcessor"
2019-03-26 09:38:21,472 main ERROR Unable to locate appender
"SumoJmeterRunlogAppender" for logger config "JmeterRunLogger"

If I set the log4j2 XML config to trace:
<Configuration status="TRACE"
packages="org.apache.jmeter.gui.logging,com.sumologic.log4j">
then the following logs are displayed:
2019-03-26 09:45:43,708 main DEBUG Took 0.129713 seconds to load 1 plugins
from package org.apache.jmeter.gui.logging
2019-03-26 09:45:43,711 main DEBUG Took 0.000764 seconds to load 0 plugins
from package com.sumologic.log4j
2019-03-26 09:45:43,712 main DEBUG PluginManager 'Core' found 117 plugins
2019-03-26 09:45:43,713 main DEBUG PluginManager 'Level' found 0 plugins
2019-03-26 09:45:43,724 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:45:43,725 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND
2019-03-26 09:45:43,727 main ERROR Error processing element
SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND

The JAR is being loaded according to the logs:
2019-03-26 09:45:49,119 DEBUG o.a.j.JMeter:
c:\projects\projects\src\test\resources\lib\ext\sumologic-log4j2-appender-1.7.jar

Given the timestamps, though, it indicates to me that the JAR is not being
loaded by JMeter until *after* log4j2 logging needs it?


On Fri, Mar 22, 2019 at 5:43 PM Philippe Mouawad <[hidden email]>
wrote:

> I guess you’re on windows from the %.
>
> Add a Non Test elements > Property display element and check that what is
> passed is correct.
>
> Do you have any warn message in logs or on console ?
>
> Thanks
>
> On Friday, March 22, 2019, Andrew Burton <[hidden email]>
> wrote:
>
> > Hi list,
> >
> > I'm using the Sumo Log4j2 appender plugin (
> > https://github.com/SumoLogic/sumologic-log4j2-appender) which pushes
> logs
> > directly to Sumo via HTTP.
> >
> > The plugin works fine when adding the JAR to JMeter's lib/ext directory
> > (and a dependency HTTP JAR to lib).
> >
> > However I keep all my JARs in a separate lib and lib/ext directory which
> > are specified at runtime using
> > -Jplugin_dependency_paths=%TEST_HOME%/resources/lib
> > and -Jsearch_paths=%TEST_HOME%/resources/lib/ext. In this situation, the
> > JARs aren't found and an exception is thrown by log4j. All other JARs are
> > loaded by JMeter without issue.
> >
> > The log4j config file is loaded through JVM_ARGs:
> > JVM_ARGS=-Dlog4j.configurationFile=file://%TEST_HOME%/conf/log4j2.xml
> >
> > I've tried setting -Juser.classpath, without success.
> >
> > Are there any other considerations when adding extra JARs for use in
> log4j
> > that people have come across?
> >
> > Thanks
> >
> > Andrew
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>