Ah well, thanks for trying, it was worth a shot. I don't think there's much I can do - the jetty classes now use static log initializers, and -verbose:class shows that the org.eclipse.jetty.util.component.AbstractLifeCycle class is loaded much earlier than even the org.mortbay.jetty.plugin.SystemProperties class. I don't know why that is, and don't know of any tool that would analyse which class caused another to be loaded?
Jan On 23 May 2012 16:16, Pieper, Aaron <piep...@pragmatics.com> 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. > > - Aaron > > -----Original Message----- > From: Jan Bartel [mailto:j...@intalio.com] > 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? > Importance: Low > > Aaron, > > 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. > > thanks > Jan > > On 22 May 2012 17:20, Pieper, Aaron <piep...@pragmatics.com> 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-boun...@eclipse.org >> [mailto:jetty-users-boun...@eclipse.org] 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. >> >> Jan >> >> On 15 May 2012 20:44, Pieper, Aaron <piep...@pragmatics.com> 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... >>> >>> >>> >>> <plugin> >>> >>> <groupId>org.mortbay.jetty</groupId> >>> >>> <artifactId>jetty-maven-plugin</artifactId> >>> >>> <version>7.5.0.v20110901</version> >>> >>> <configuration> >>> >>> <war>${project.build.directory}/${webappName}.war</war> >>> >>> ... snip ... >>> >>> <systemProperties> >>> >>> <systemProperty> >>> >>> <key>log4j.configuration</key> >>> >>> >>> <value>file:${project.build.outputDirectory}/log4j.properties</value> >>> >>> </systemProperty> >>> >>> >>> >>> 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 >>> -Dlog4j.configuration=file:./target/classes/log4j.properties", >>> 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 >>> (http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin#MavenJetty >>> P lugin-sysprops), but I cannot find any comparable documentation for >>> the Jetty 7 plugin. The closest thing I can find >>> (http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin) says, "For >>> more information, see Setting System Properties," but there is no >>> hyperlink anywhere. Was this omitted accidentally? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> - Aaron >>> >>> >>> _______________________________________________ >>> jetty-users mailing list >>> jetty-users@eclipse.org >>> https://dev.eclipse.org/mailman/listinfo/jetty-users >>> >> _______________________________________________ >> jetty-users mailing list >> jetty-users@eclipse.org >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> _______________________________________________ >> jetty-users mailing list >> jetty-users@eclipse.org >> https://dev.eclipse.org/mailman/listinfo/jetty-users _______________________________________________ jetty-users mailing list jetty-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/jetty-users