logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: Cannot load custom plugin with the "packages" configuration property when packaged in a jar file
Date Fri, 10 Jun 2016 11:49:47 GMT
I would prefer a Jira ticket because email quickly drops below the horizon...

Sent from my iPhone

> On 2016/06/10, at 17:02, Anthony Maire <maire.anthony@gmail.com> wrote:
> 
> The first log file was obtained for the real plugin (which has dependency to some code
that I can't publish), the "test" package is a minimal example I made after my first mail
to reproduce the issue.
> I didn't copy/paste the log file again, but I had this message when the jar in the classpath
"2016-06-09 19:40:44,823 main DEBUG Took 0,001222 seconds to load 0 plugins from package test"
> (and the plugin is correctly loaded with the source in eclipse)
> 
> Using the "packages" property was the simplest solution for me while trying to test my
plugin. I will try to generate the .dat file to make it works.
> 
> As requested, please find a complete example (config file, application and plugin sources,
and plugin as a jar without the .dat file) in the attached zip. You will need to remove the
fake txt extension, zip files are blocked on my email address ...
> Let me know if I should open a JIRA ticket for this
> 
> Regards,
> Anthony
> 
> 
> 
> 
> 2016-06-09 21:53 GMT+02:00 Ralph Goers <ralph.goers@dslextreme.com>:
>> Your jar does not have the Log4j2Plugins.dat file in it which indicates the log4j
annotation processor did not run. You really should have this enabled. Although specifying
the packages attribute should work it is much slower to find the plugins.  Your log file below
show  package com.***.util.logging.log4j as being searched, not test.
>> 
>> Can you create a zip file with all the parts, with source, that shows the problem?
 Doing this piecemeal is a bit tough.
>> 
>> Ralph
>> 
>> > On Jun 9, 2016, at 10:47 AM, Anthony Maire <maire.anthony@gmail.com> wrote:
>> >
>> > I made a simplified example (cf attached files)
>> > My log4j2.xml starts with:
>> > <Configuration status="trace" packages="test">
>> >
>> > And my application main method with :
>> >
>> >               String className = "test.DefaultFilter";
>> >               Class<?> filterClass = Class.forName(className);
>> >               Object filter = filterClass.newInstance();
>> >
>> > (and it does not fail)
>> >
>> > => With the .java file in eclipse, the plugin is correctly loaded, but with
the jar file in the classpath only, no plugin is loaded
>> >
>> >
>> >
>> >
>> > 2016-06-09 18:54 GMT+02:00 Ralph Goers <ralph.goers@dslextreme.com <mailto:ralph.goers@dslextreme.com>>:
>> > We would have to see the plugin to see if it is annotated correctly.
>> >
>> > Ralph
>> >
>> > > On Jun 9, 2016, at 9:49 AM, Anthony Maire <maire.anthony@gmail.com <mailto:maire.anthony@gmail.com>>
wrote:
>> > >
>> > > Hello
>> > >
>> > > I'm trying to test some custom filters/layout with an existing application.
>> > > When I use them in a dummy test application launched from eclipse,
>> > > everything if fine, they are correctly loaded if I specify a "packages"
>> > > property in the configuration
>> > >
>> > > However, when packaging the plugin classes in a jar file to run with the
>> > > real applications, they are not loaded, cf this log with status="trace"
>> > >
>> > >
>> > > I made another test: I removed the plugins source from my eclipse, and
run
>> > > the dummy application that was working with the jar file in the classpath,
>> > > the plugins are not loaded too. I made sure that the jar is in the
>> > > classpath: the dummy application starts with a Class.forName() on one of
>> > > the plugin classes and it does succeed ...
>> > >
>> > > 2016-06-09 17:50:18,488 main DEBUG Installed script engines
>> > > 2016-06-09 17:50:23,998 main DEBUG Oracle Nashorn Version: 1.8.0_45,
>> > > Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names:
>> > > {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
>> > > 2016-06-09 17:50:24,013 main DEBUG Took 0,007874 seconds to load 0 plugins
>> > > from package com.***.util.logging.log4j
>> > >
>> > >
>> > > Any idea ?
>> > >
>> > > Regards,
>> > > Anthony
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org <mailto:log4j-user-unsubscribe@logging.apache.org>
>> > For additional commands, e-mail: log4j-user-help@logging.apache.org <mailto:log4j-user-help@logging.apache.org>
>> >
>> >
>> > <defaultFilter.jar>
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> <log4j-plugin-load-issue.zip.txt>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message