Issue #984 Improve module listing

Reworked logging modules
added support for ,= and += properties
This commit is contained in:
Greg Wilkins 2016-10-07 12:48:47 +11:00
parent 97d18665ef
commit d8b1c88abc
36 changed files with 205 additions and 144 deletions

View File

@ -5,23 +5,14 @@ Control GCloud API classpath
3rdparty
gcloud
[files]
basehome:modules/gcloud/gcloud.xml|etc/gcloud.xml
[lib]
lib/gcloud/*.jar
[xml]
etc/gcloud.xml
[license]
GCloudDatastore is an open source project hosted on Github and released under the Apache 2.0 license.
https://github.com/GoogleCloudPlatform/gcloud-java
http://www.apache.org/licenses/LICENSE-2.0.html
[ini-template]
## Configure the jars and packages exposed or hidden from webapps by comma separated
## list of classnames, package names or file URIs (See ClasspathPattern)
## Eg. to hide all gcloud dependencies other than the com.google.guava package:
## Default is all jars in lib/gcloud are hidden
# gcloud.addServerClasses=file:${jetty.base}/lib/gcloud,-com.google.guava.
## Hide the gcloud libraries from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/gcloud/

View File

@ -364,7 +364,7 @@ public class StartArgs
}
else
{
System.out.printf(" %s = %s%n",key,properties.expand(prop.value));
System.out.printf(" %s = %s%n",key,prop.value);
if (StartLog.isDebugEnabled())
{
System.out.printf(" origin: %s%n",prop.origin);
@ -372,7 +372,7 @@ public class StartArgs
{
prop = prop.overrides;
System.out.printf(" (overrides)%n");
System.out.printf(" %s = %s%n",key,properties.expand(prop.value));
System.out.printf(" %s = %s%n",key,prop.value);
System.out.printf(" origin: %s%n",prop.origin);
}
}
@ -398,7 +398,7 @@ public class StartArgs
for (String key : sortedKeys)
{
String value = System.getProperty(key);
System.out.printf(" %s = %s%n",key,properties.expand(value));
System.out.printf(" %s = %s%n",key,value);
}
}
@ -1050,13 +1050,33 @@ public class StartArgs
}
// Is this a raw property declaration?
int idx = arg.indexOf('=');
if (idx >= 0)
int equals = arg.indexOf('=');
if (equals >= 0)
{
String key = arg.substring(0,idx);
String value = arg.substring(idx + 1);
String key = arg.substring(0,equals);
String value = arg.substring(equals + 1);
if (replaceProps)
if (key.endsWith("+"))
{
key = key.substring(0,key.length()-1);
String orig = getProperties().getString(key);
if (orig != null && !orig.isEmpty())
{
value=orig+value;
source=propertySource.get(key)+","+source;
}
}
else if (key.endsWith(","))
{
key = key.substring(0,key.length()-1);
String orig = getProperties().getString(key);
if (orig != null && !orig.isEmpty())
{
value=value.isEmpty()?orig:(orig+","+value);
source=propertySource.get(key)+","+source;
}
}
else if (replaceProps)
{
if (propertySource.containsKey(key))
{
@ -1065,17 +1085,6 @@ public class StartArgs
propertySource.put(key,source);
}
if ("OPTION".equals(key) || "OPTIONS".equals(key))
{
StringBuilder warn = new StringBuilder();
warn.append("The behavior of the argument ");
warn.append(arg).append(" (seen in ").append(source);
warn.append(") has changed, and is now considered a normal property. ");
warn.append(key).append(" no longer controls what libraries are on your classpath,");
warn.append(" use --module instead. See --help for details.");
StartLog.warn(warn.toString());
}
setProperty(key,value,source,replaceProps);
return;
}
@ -1184,7 +1193,9 @@ public class StartArgs
return;
}
if (replaceProp || (!properties.containsKey(key)))
if (value==null || value.isEmpty())
properties.remove(key,value,source);
else if (replaceProp || (!properties.containsKey(key)))
{
properties.setProperty(key,value,source);
if(key.equals("java.version"))

View File

@ -147,6 +147,15 @@ Startup / Shutdown Command Line:
Properties:
name=value
Set a property that can be expanded in XML files with the <Property> element.
name+=value
Add to an existing property.
name,=value
Add to an existing property as a comma separated list.
STOP.HOST=[string]
The host to use to stop the running Jetty server (defaults to 127.0.0.1)
Required along with STOP.PORT if you want to use the --stop option above.

View File

@ -12,3 +12,5 @@ PROP|main.prop=value0
PROP|port=9090
PROP|other=value
PROP|jetty.http.port=9090
PROP|add=beginningmiddleend
PROP|list=one,two,three

View File

@ -1,2 +1,8 @@
other=value
port=9090
add+=beginning
add+=middle
add+=end
list,=one
list,=two
list,=three

View File

@ -1,6 +1,5 @@
[description]
Provides a Java Commons Logging implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
Provides a Java Commons Logging (JCL) to SLF4J logging bridge.
[tags]
logging

View File

@ -1,12 +0,0 @@
[description]
Provides a Jetty Logging implementation that logs to the Java Util Logging API.
Requires another module that provides a Java Util Logging implementation.
[tags]
logging
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog

View File

@ -1,12 +0,0 @@
[description]
Provides a Jetty Logging implementation that logs to the log4j API.
Uses the slf4j mechanism as an intermediary
Requires another module that provides an log4j implementation.
[tags]
logging
log4j
[depend]
jetty-slf4j
slf4j-log4j

View File

@ -1,13 +0,0 @@
[description]
Provides a Jetty Logging implementation that logs to the log4j API.
Uses the slf4j and log4j v1.2 mechanisms as intermediaries.
Requires another module that provides an log4j2 implementation.
[tags]
logging
log4j2
log4j
[depend]
jetty-slf4j
slf4j-log4j2

View File

@ -1,10 +0,0 @@
[description]
Provides a Jetty Logging implementation that logs to logback.
Uses the slf4j API as an intermediary
[tags]
logging
[depend]
jetty-slf4j
slf4j-logback

View File

@ -1,16 +0,0 @@
[description]
Enables the Jetty Logging implementation and installs a template
configuration in ${jetty.base} resources/jetty-logging.properties.
[tags]
logging
[depends]
resources
[provide]
logging
[files]
basehome:modules/jetty-logging/jetty-logging.properties|resources/jetty-logging.properties

View File

@ -1,17 +0,0 @@
[description]
Provides a Jetty Logging implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
[tags]
logging
slf4j
[depend]
slf4j-api
slf4j-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog

View File

@ -1,7 +1,5 @@
[description]
Provides a Log4j v1.2 implementation that logs to the Log4j v2 API.
Requires another module that provides and Log4j v2 implementation.
To receive jetty logs the jetty-slf4j and slf4j-log4j must also be enabled.
Provides a Log4j v1.2 to Log4j v2 logging bridge.
[tags]
logging

View File

@ -1,7 +1,5 @@
[description]
Provides the Log4j v2 API
Requires another module that provides an Log4j v2 implementation.
To receive jetty logs enable the jetty-slf4j, slf4j-log4j and log4j-log4j2 modules.
[tags]
logging

View File

@ -1,7 +1,5 @@
[description]
Provides a Log4j v2 implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
To receive jetty logs enable the jetty-slf4j module.
Provides a Log4j v2 to SLF4J logging bridge.
[tags]
logging

View File

@ -1,5 +1,5 @@
[description]
Provides the logback core implementation, used by slf4j-logback
Provides the logback core implementation
and logback-access
[tags]

View File

@ -0,0 +1,20 @@
[description]
Configure jetty logging to use Java Commons Logging (jcl)
Uses SLF4j as a logging bridge.
[tags]
logging
[depends]
slf4j-jcl
jcl-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/,file:${jetty.base}/lib/jul

View File

@ -0,0 +1,15 @@
[description]
Configure jetty logging mechanism.
Provides a ${jetty.base}/resources/jetty-logging.properties.
[tags]
logging
[depends]
resources
[provide]
logging
[files]
basehome:modules/logging-jetty/jetty-logging.properties|resources/jetty-logging.properties

View File

@ -0,0 +1,19 @@
[description]
Configure jetty logging to use Java Util Logging (jul)
Uses SLF4j as a logging bridge.
[tags]
logging
[depends]
slf4j-jul
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/

View File

@ -0,0 +1,20 @@
[description]
Configure jetty logging to use Log4j Logging
Uses SLF4j as a logging bridge.
[tags]
logging
[depends]
slf4j-log4j
log4j-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/,file:${jetty.base}/lib/log4j/

View File

@ -0,0 +1,20 @@
[description]
Configure jetty logging to use log4j version 2
Uses SLF4j as a logging bridge.
[tags]
logging
[depends]
slf4j-log4j2
log4j2-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/,file:${jetty.base}/lib/log4j/

View File

@ -0,0 +1,20 @@
[description]
Configure jetty logging to use Logback Logging.
Uses SLF4j as a logging bridge.
[tags]
logging
[depends]
slf4j-logback
logback-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/,file:${jetty.base}/lib/logback

View File

@ -0,0 +1,19 @@
[description]
Configure jetty logging to use slf4j.
Any slf4j-impl implementation is used
[tags]
logging
[depends]
slf4j-impl
[provide]
logging
[exec]
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
[ini-template]
## Hide logging classes from deployed webapps
jetty.webapp.addServerClasses,=file:${jetty.base}/lib/slf4j/

View File

@ -2,15 +2,20 @@
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call class="org.eclipse.jetty.webapp.WebAppContext" name="addSystemClasses">
<Arg><Ref refid="Server"/></Arg>
<Arg>
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit">
<Arg><Property name="jetty.webapp.addSystemClasses"/></Arg>
</Call>
</Arg>
</Call>
<!-- ===================================================================== -->
<!-- Configure a GCloud classpath exposed to webapps -->
<!-- ===================================================================== -->
<Call class="org.eclipse.jetty.webapp.WebAppContext" name="addServerClasses">
<Arg><Ref refid="Server"/></Arg>
<Arg>
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit">
<Arg><Property name="gcloud.addServerClasses"><Default>file:<Property name="jetty.base"/>/lib/gcloud</Default></Property></Arg>
<Arg><Property name="jetty.webapp.addServerClasses"/></Arg>
</Call>
</Arg>
</Call>

View File

@ -1,7 +1,5 @@
[description]
Provides a SLF4J implementation that logs to the Java Commons Logging API.
Requires another module that provides an JCL implementation.
To receive jetty logs enable the jetty-slf4j module.
Provides a SLF4J to Java Commons Logging (JCL) logging bridge.
[tags]
logging

View File

@ -1,6 +1,5 @@
[description]
Provides a SLF4J implementation that logs to the Java Util Logging API.
To receive jetty logs enable the jetty-slf4j module.
Provides a SLF4J to Java Util Logging (JUL) logging bridge.
[tags]
logging

View File

@ -1,7 +1,5 @@
[description]
Provides a SLF4J implementation that logs to the Log4j v1.2 API.
Requires another module that provides a Log4j implementation.
To receive jetty logs enable the jetty-slf4j module.
Provides a SLF4J to the Log4j v1.2 API logging bridge.
[tags]
logging

View File

@ -1,7 +1,5 @@
[description]
Provides a SLF4J implementation that logs to the Log4j v2 API.
Requires another module that provides a Log4j2 implementation.
To receive jetty logs enable the jetty-slf4j2 module.
Provides a SLF4J to Log4j v2 logging bridge.
[tags]
logging

View File

@ -1,6 +1,5 @@
[description]
Provides a SLF4J implementation that logs to Logback classic
To receive jetty logs enable the jetty-slf4j module.
Provides a SLF4J to Logback logging bridge.
[tags]
logging
@ -9,7 +8,7 @@ verbose
[depend]
slf4j-api
logback-core
logback-impl
resources
[provide]

View File

@ -12,7 +12,6 @@ etc/stderrout-logging.xml
logs/
[lib]
lib/logging/**.jar
resources/
[ini-template]

View File

@ -24,5 +24,5 @@ lib/jetty-webapp-${jetty.version}.jar
## + a directory of jars,resource or classes e.g. 'file:${jetty.base}/resources'
## + A pattern preceeded with a '-' is an exclusion, all other patterns are inclusions
##
#jetty.webapp.addSystemClasses=
#jetty.webapp.addServerClasses=
jetty.webapp.addSystemClasses,=
jetty.webapp.addServerClasses,=