Actually, the issue wasn’t the missing hyperlink– the entire “Setting System Properties” section was absent until this morning! But Jan authored that section a few hours ago, so it’s looking much better now. Thanks to both of you for your hard work!
From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Shirley Boulay
Sent: Wednesday, May 23, 2012 11:34 AM
To: JETTY user mailing list
Subject: Re: [jetty-users] jetty-maven-plugin v7.5.0.v20110901 no longer respects system properties?
The information about setting system properties is in a later section of http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin. Unfortunately, I neglected to link to it. I've fixed that now. Here is the link: http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Setting_System_Properties.
Hopefully the information you need is available there.
On Wed, May 23, 2012 at 10:16 AM, Pieper, Aaron <PieperA@xxxxxxxxxxxxxx> wrote:
I tried shifting the <systemProperties> element to be the first child of the <configuration> element, but it still behaves the same way - the AbstractLifeCycle.LOG field is still initialized before any of the properties are set.
From: Jan Bartel [mailto:janb@xxxxxxxxxxx]
Sent: Wednesday, May 23, 2012 4:32 AM
To: JETTY user mailing list
Cc: Pieper, Aaron
Subject: [SPAM] Re: [jetty-users] [SPAM] Re: jetty-maven-plugin v7.5.0.v20110901 no longer respects system properties?
Out of curiosity, can you try instead shifting your <systemProperties> up to be the first configuration of the plugin, before any <webApp> (aliased also to <webAppConfig>) or any other elements? Perhaps that will get the system property set before any Jetty classes are loaded that cause the loading of AbstractLifeCycle class and its static LOG reference.
Let me know if that works and I'll update the doco.
On 22 May 2012 17:20, Pieper, Aaron <PieperA@xxxxxxxxxxxxxx> wrote:
> I did a little more research and found out what's causing this conflict between newer versions of Jetty, and Log4j.
> When the AbstractLifeCycle class is loaded in Jetty 7.5.0, it initializes its static LOG field which results in a getLogger call, initializing the Log4j framework. At this time, the "log4j.configuration" system property is unset. ObjectWithFieldsConverter.processConfiguration is later invoked, which sets the system properties appropriately. However, by this time, log4j has already been initialized improperly because of AbstractLifeCycle's getLogger invocation.
> Back in Jetty 7.4.5, setProperty was invoked by ObjectWithFieldsConverter.processConfiguration, but the log was not initialized until later. There were no Jetty calls to getLogger, so the logging system wasn't initialized until my web application started up. The AbstractLifeCycle.LOG field is new to Jetty 7.5.0, and causes the Log4j system to be initialized before the jetty-maven-plugin has a chance to set system properties.
> I was able to work around this problem by using the properties-maven-plugin (http://mojo.codehaus.org/properties-maven-plugin/) to set the system property before Jetty's AbstractLifeCycle class is loaded. However, this seems like a regression in Jetty since after Jetty 7.5.0, the SystemProperties parameter can no longer be used to initialize logging systems like log4j. This regression seems like it would also affect any other logging systems which lazily initialize in response to the first getLogger call.
> - Aaron
> -----Original Message-----
> From: jetty-users-bounces@xxxxxxxxxxx
> [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Jan Bartel
> Sent: Monday, May 21, 2012 10:07 AM
> To: JETTY user mailing list
> Subject: [SPAM] Re: [jetty-users] jetty-maven-plugin v7.5.0.v20110901 no longer respects system properties?
> Importance: Low
> Can you print out or otherwise examine what the value of the
> SystemProperty that is set via the pom.xml is at runtime? AFAIK, the
> system property stuff has not changed in a long time ... BTW,
> jetty-7.5 is still a very old version, the most recent being 7.6.3.
> On 15 May 2012 20:44, Pieper, Aaron <PieperA@xxxxxxxxxxxxxx> wrote:
>> I run Jetty via the jetty-maven-plugin, from the command line, with a
>> command like "mvn jetty:run". After upgrading from jetty-maven-plugin
>> v7.4.5.v20110725 to v7.5.0.v20110901, my log4j.properties file is no
>> longer being parsed. It is not being parsed because the
>> log4j.configuration system property is no longer being set when
>> running Jetty. I have this configuration in my pom.xml...
>> ... snip ...
>> As of Jetty v7.5.0, this log4j.configuration system property is no
>> longer being respected. I can still set the property via the command
>> line with "mvn jetty:run
>> this works fine. I suspect this problem is due to a change in syntax
>> of the systemProperties xml element.
>> There is documentation for setting up the systemProperties element
>> with the Jetty 6 plugin
>> P lugin-sysprops), but I cannot find any comparable documentation for