284475 update jetty.sh for new OPTIONS syntax
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@588 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
bb50e1bac8
commit
9ad7377e13
|
@ -5,6 +5,7 @@ jetty-7.0.0.RC2-SNAPSHOT
|
|||
+ backport jetty-8 annotation parsing to jetty-7
|
||||
+ Disassociate method on IdentityService
|
||||
+ 284510 Enhance jetty-start for diagnosis and unit testing
|
||||
+ 284475 update jetty.sh for new OPTIONS syntax
|
||||
|
||||
jetty-7.0.0.RC1 15 June 2009
|
||||
+ JETTY-1066 283357 400 response for bad URIs
|
||||
|
|
|
@ -115,12 +115,6 @@ running()
|
|||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##################################################
|
||||
# Get the action & configs
|
||||
##################################################
|
||||
|
@ -128,7 +122,6 @@ running()
|
|||
ACTION=$1
|
||||
shift
|
||||
ARGS="$*"
|
||||
CONFIGS=""
|
||||
NO_START=0
|
||||
|
||||
##################################################
|
||||
|
@ -232,7 +225,6 @@ fi
|
|||
cd $JETTY_HOME
|
||||
JETTY_HOME=`pwd`
|
||||
|
||||
|
||||
#####################################################
|
||||
# Check that jetty is where we think it is
|
||||
#####################################################
|
||||
|
@ -243,40 +235,6 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
###########################################################
|
||||
# Get the list of config.xml files from the command line.
|
||||
###########################################################
|
||||
if [ ! -z "$ARGS" ]
|
||||
then
|
||||
for A in $ARGS
|
||||
do
|
||||
if [ -f $A ]
|
||||
then
|
||||
CONF="$A"
|
||||
elif [ -f $JETTY_HOME/etc/$A ]
|
||||
then
|
||||
CONF="$JETTY_HOME/etc/$A"
|
||||
elif [ -f ${A}.xml ]
|
||||
then
|
||||
CONF="${A}.xml"
|
||||
elif [ -f $JETTY_HOME/etc/${A}.xml ]
|
||||
then
|
||||
CONF="$JETTY_HOME/etc/${A}.xml"
|
||||
else
|
||||
echo "** ERROR: Cannot find configuration '$A' specified in the command line."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -r $CONF ]
|
||||
then
|
||||
echo "** ERROR: Cannot read configuration '$A' specified in the command line."
|
||||
exit 1
|
||||
fi
|
||||
CONFIGS="$CONFIGS $CONF"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
##################################################
|
||||
# Try to find this script's configuration file,
|
||||
# but only if no configurations were given on the
|
||||
|
@ -297,55 +255,11 @@ fi
|
|||
# Read the configuration file if one exists
|
||||
##################################################
|
||||
CONFIG_LINES=
|
||||
if [ -z "$CONFIGS" ] && [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
|
||||
if [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
|
||||
then
|
||||
CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | tr "\n" " "`
|
||||
fi
|
||||
|
||||
##################################################
|
||||
# Get the list of config.xml files from jetty.conf
|
||||
##################################################
|
||||
if [ ! -z "${CONFIG_LINES}" ]
|
||||
then
|
||||
for CONF in ${CONFIG_LINES}
|
||||
do
|
||||
if [ ! -r "$CONF" ]
|
||||
then
|
||||
echo "** WARNING: Cannot read '$CONF' specified in '$JETTY_CONF'"
|
||||
elif [ -f "$CONF" ]
|
||||
then
|
||||
# assume it's a configure.xml file
|
||||
CONFIGS="$CONFIGS $CONF"
|
||||
elif [ -d "$CONF" ]
|
||||
then
|
||||
# assume it's a directory with configure.xml files
|
||||
# for example: /etc/jetty.d/
|
||||
# sort the files before adding them to the list of CONFIGS
|
||||
XML_FILES=`ls ${CONF}/*.xml | sort | tr "\n" " "`
|
||||
for FILE in ${XML_FILES}
|
||||
do
|
||||
if [ -r "$FILE" ] && [ -f "$FILE" ]
|
||||
then
|
||||
CONFIGS="$CONFIGS $FILE"
|
||||
else
|
||||
echo "** WARNING: Cannot read '$FILE' specified in '$JETTY_CONF'"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "** WARNING: Don''t know what to do with '$CONF' specified in '$JETTY_CONF'"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#####################################################
|
||||
# Run the standard server if there's nothing else to run
|
||||
#####################################################
|
||||
if [ -z "$CONFIGS" ]
|
||||
then
|
||||
CONFIGS="${JETTY_HOME}/etc/jetty-logging.xml ${JETTY_HOME}/etc/jetty.xml"
|
||||
fi
|
||||
|
||||
|
||||
#####################################################
|
||||
# Find a location for the pid file
|
||||
#####################################################
|
||||
|
@ -380,7 +294,7 @@ then
|
|||
/usr/local/java \
|
||||
/usr/local/jdk \
|
||||
/usr/local/jre \
|
||||
/usr/lib/jvm \
|
||||
/usr/lib/jvm \
|
||||
/opt/java \
|
||||
/opt/jdk \
|
||||
/opt/jre \
|
||||
|
@ -479,14 +393,10 @@ case "`uname`" in
|
|||
CYGWIN*)
|
||||
JETTY_START="`cygpath -w $JETTY_START`"
|
||||
echo $JETTY_START
|
||||
|
||||
CONFIGS="`cygpath -w $CONFIGS`"
|
||||
echo $CONFIGS
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START $JETTY_ARGS $CONFIGS"
|
||||
RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START --fromDaemon $JETTY_ARGS $ARGS"
|
||||
RUN_CMD="$JAVA $RUN_ARGS"
|
||||
|
||||
#####################################################
|
||||
|
@ -498,7 +408,7 @@ RUN_CMD="$JAVA $RUN_ARGS"
|
|||
#echo "JETTY_RUN = $JETTY_RUN"
|
||||
#echo "JETTY_PID = $JETTY_PID"
|
||||
#echo "JETTY_ARGS = $JETTY_ARGS"
|
||||
#echo "CONFIGS = $CONFIGS"
|
||||
#echo "ARGS = $ARGS"
|
||||
#echo "JAVA_OPTIONS = $JAVA_OPTIONS"
|
||||
#echo "JAVA = $JAVA"
|
||||
|
||||
|
@ -534,7 +444,7 @@ case "$ACTION" in
|
|||
else
|
||||
|
||||
if [ -f $JETTY_PID ]
|
||||
then
|
||||
then
|
||||
if running $JETTY_PID
|
||||
then
|
||||
echo "Already Running!!"
|
||||
|
@ -651,7 +561,6 @@ case "$ACTION" in
|
|||
echo "JETTY_PID = $JETTY_PID"
|
||||
echo "JETTY_PORT = $JETTY_PORT"
|
||||
echo "JETTY_LOGS = $JETTY_LOGS"
|
||||
echo "CONFIGS = $CONFIGS"
|
||||
echo "JAVA_OPTIONS = $JAVA_OPTIONS"
|
||||
echo "JAVA = $JAVA"
|
||||
echo "CLASSPATH = $CLASSPATH"
|
||||
|
|
|
@ -117,12 +117,6 @@ running()
|
|||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##################################################
|
||||
# Get the action & configs
|
||||
##################################################
|
||||
|
@ -130,7 +124,6 @@ running()
|
|||
ACTION=$1
|
||||
shift
|
||||
ARGS="$*"
|
||||
CONFIGS=""
|
||||
NO_START=0
|
||||
|
||||
##################################################
|
||||
|
@ -230,6 +223,7 @@ if [ -z "$JETTY_HOME" ] ; then
|
|||
echo "** ERROR: JETTY_HOME not set, you need to set it or install in a standard location"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $JETTY_HOME
|
||||
JETTY_HOME=`pwd`
|
||||
|
||||
|
@ -243,40 +237,6 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
###########################################################
|
||||
# Get the list of config.xml files from the command line.
|
||||
###########################################################
|
||||
if [ ! -z "$ARGS" ]
|
||||
then
|
||||
for A in $ARGS
|
||||
do
|
||||
if [ -f $A ]
|
||||
then
|
||||
CONF="$A"
|
||||
elif [ -f $JETTY_HOME/etc/$A ]
|
||||
then
|
||||
CONF="$JETTY_HOME/etc/$A"
|
||||
elif [ -f ${A}.xml ]
|
||||
then
|
||||
CONF="${A}.xml"
|
||||
elif [ -f $JETTY_HOME/etc/${A}.xml ]
|
||||
then
|
||||
CONF="$JETTY_HOME/etc/${A}.xml"
|
||||
else
|
||||
echo "** ERROR: Cannot find configuration '$A' specified in the command line."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -r $CONF ]
|
||||
then
|
||||
echo "** ERROR: Cannot read configuration '$A' specified in the command line."
|
||||
exit 1
|
||||
fi
|
||||
CONFIGS="$CONFIGS $CONF"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
##################################################
|
||||
# Try to find this script's configuration file,
|
||||
# but only if no configurations were given on the
|
||||
|
@ -297,55 +257,11 @@ fi
|
|||
# Read the configuration file if one exists
|
||||
##################################################
|
||||
CONFIG_LINES=
|
||||
if [ -z "$CONFIGS" ] && [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
|
||||
if [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
|
||||
then
|
||||
CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | tr "\n" " "`
|
||||
fi
|
||||
|
||||
##################################################
|
||||
# Get the list of config.xml files from jetty.conf
|
||||
##################################################
|
||||
if [ ! -z "${CONFIG_LINES}" ]
|
||||
then
|
||||
for CONF in ${CONFIG_LINES}
|
||||
do
|
||||
if [ ! -r "$CONF" ]
|
||||
then
|
||||
echo "** WARNING: Cannot read '$CONF' specified in '$JETTY_CONF'"
|
||||
elif [ -f "$CONF" ]
|
||||
then
|
||||
# assume it's a configure.xml file
|
||||
CONFIGS="$CONFIGS $CONF"
|
||||
elif [ -d "$CONF" ]
|
||||
then
|
||||
# assume it's a directory with configure.xml files
|
||||
# for example: /etc/jetty.d/
|
||||
# sort the files before adding them to the list of CONFIGS
|
||||
XML_FILES=`ls ${CONF}/*.xml | sort | tr "\n" " "`
|
||||
for FILE in ${XML_FILES}
|
||||
do
|
||||
if [ -r "$FILE" ] && [ -f "$FILE" ]
|
||||
then
|
||||
CONFIGS="$CONFIGS $FILE"
|
||||
else
|
||||
echo "** WARNING: Cannot read '$FILE' specified in '$JETTY_CONF'"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "** WARNING: Don''t know what to do with '$CONF' specified in '$JETTY_CONF'"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#####################################################
|
||||
# Run the standard server if there's nothing else to run
|
||||
#####################################################
|
||||
if [ -z "$CONFIGS" ]
|
||||
then
|
||||
CONFIGS="${JETTY_HOME}/etc/jetty-logging.xml ${JETTY_HOME}/etc/jetty.xml"
|
||||
fi
|
||||
|
||||
|
||||
#####################################################
|
||||
# Find a location for the pid file
|
||||
#####################################################
|
||||
|
@ -380,7 +296,7 @@ then
|
|||
/usr/local/java \
|
||||
/usr/local/jdk \
|
||||
/usr/local/jre \
|
||||
/usr/lib/jvm \
|
||||
/usr/lib/jvm \
|
||||
/opt/java \
|
||||
/opt/jdk \
|
||||
/opt/jre \
|
||||
|
@ -475,7 +391,7 @@ JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.home=$JETTY_HOME -Djava.io.tmpdir=$TMP"
|
|||
JETTY_START=$JETTY_HOME/start.jar
|
||||
[ ! -f $JETTY_START ] && JETTY_START=$JETTY_HOME/lib/start.jar
|
||||
|
||||
RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START $JETTY_ARGS $CONFIGS"
|
||||
RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START --fromDaemon $JETTY_ARGS $ARGS"
|
||||
RUN_CMD="$JAVA $RUN_ARGS"
|
||||
|
||||
#####################################################
|
||||
|
@ -487,7 +403,7 @@ RUN_CMD="$JAVA $RUN_ARGS"
|
|||
#echo "JETTY_RUN = $JETTY_RUN"
|
||||
#echo "JETTY_PID = $JETTY_PID"
|
||||
#echo "JETTY_ARGS = $JETTY_ARGS"
|
||||
#echo "CONFIGS = $CONFIGS"
|
||||
#echo "ARGS = $ARGS"
|
||||
#echo "JAVA_OPTIONS = $JAVA_OPTIONS"
|
||||
#echo "JAVA = $JAVA"
|
||||
|
||||
|
@ -640,7 +556,6 @@ case "$ACTION" in
|
|||
echo "JETTY_PID = $JETTY_PID"
|
||||
echo "JETTY_PORT = $JETTY_PORT"
|
||||
echo "JETTY_LOGS = $JETTY_LOGS"
|
||||
echo "CONFIGS = $CONFIGS"
|
||||
echo "JAVA_OPTIONS = $JAVA_OPTIONS"
|
||||
echo "JAVA = $JAVA"
|
||||
echo "CLASSPATH = $CLASSPATH"
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.start;
|
||||
|
@ -146,7 +146,7 @@ public class Config
|
|||
/**
|
||||
* Natural language sorting for key names.
|
||||
*/
|
||||
private Comparator<String> keySorter = new Comparator<String>()
|
||||
private Comparator<String> keySorter = new Comparator<String>()
|
||||
{
|
||||
private Collator collator = Collator.getInstance();
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class Config
|
|||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isDebug()
|
||||
{
|
||||
return DEBUG;
|
||||
|
@ -352,7 +352,12 @@ public class Config
|
|||
cp.overlay(_classpaths.get(DEFAULT_SECTION));
|
||||
for (String sectionId : sectionIds)
|
||||
{
|
||||
cp.overlay(_classpaths.get(sectionId));
|
||||
Classpath otherCp = _classpaths.get(sectionId);
|
||||
if (otherCp == null)
|
||||
{
|
||||
throw new IllegalArgumentException("No such OPTIONS: " + sectionId);
|
||||
}
|
||||
cp.overlay(otherCp);
|
||||
}
|
||||
cp.overlay(_classpaths.get("*"));
|
||||
return cp;
|
||||
|
@ -604,18 +609,18 @@ public class Config
|
|||
String version = st.nextToken();
|
||||
ver.parse(version);
|
||||
eval = (operator.equals("<") && java_version.compare(ver) < 0) || (operator.equals(">") && java_version.compare(ver) > 0)
|
||||
|| (operator.equals("<=") && java_version.compare(ver) <= 0) || (operator.equals("=<") && java_version.compare(ver) <= 0)
|
||||
|| (operator.equals("=>") && java_version.compare(ver) >= 0) || (operator.equals(">=") && java_version.compare(ver) >= 0)
|
||||
|| (operator.equals("==") && java_version.compare(ver) == 0) || (operator.equals("!=") && java_version.compare(ver) != 0);
|
||||
|| (operator.equals("<=") && java_version.compare(ver) <= 0) || (operator.equals("=<") && java_version.compare(ver) <= 0)
|
||||
|| (operator.equals("=>") && java_version.compare(ver) >= 0) || (operator.equals(">=") && java_version.compare(ver) >= 0)
|
||||
|| (operator.equals("==") && java_version.compare(ver) == 0) || (operator.equals("!=") && java_version.compare(ver) != 0);
|
||||
}
|
||||
else if (condition.equals("nargs"))
|
||||
{
|
||||
String operator = st.nextToken();
|
||||
int number = Integer.parseInt(st.nextToken());
|
||||
eval = (operator.equals("<") && argCount < number) || (operator.equals(">") && argCount > number)
|
||||
|| (operator.equals("<=") && argCount <= number) || (operator.equals("=<") && argCount <= number)
|
||||
|| (operator.equals("=>") && argCount >= number) || (operator.equals(">=") && argCount >= number)
|
||||
|| (operator.equals("==") && argCount == number) || (operator.equals("!=") && argCount != number);
|
||||
|| (operator.equals("<=") && argCount <= number) || (operator.equals("=<") && argCount <= number)
|
||||
|| (operator.equals("=>") && argCount >= number) || (operator.equals(">=") && argCount >= number)
|
||||
|| (operator.equals("==") && argCount == number) || (operator.equals("!=") && argCount != number);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -641,113 +646,113 @@ public class Config
|
|||
setProperty(property,value);
|
||||
}
|
||||
else
|
||||
// Setting of start property with canonical path
|
||||
if (subject.indexOf("/=") > 0)
|
||||
{
|
||||
int i = file.indexOf("/=");
|
||||
String property = file.substring(0,i);
|
||||
String value = fixPath(file.substring(i + 2));
|
||||
String canonical = new File(value).getCanonicalPath();
|
||||
debug(" " + property + "/=" + value + "==" + canonical);
|
||||
setProperty(property,canonical);
|
||||
}
|
||||
else
|
||||
// Setting of system property
|
||||
if (subject.indexOf("=") > 0)
|
||||
{
|
||||
int i = file.indexOf("=");
|
||||
String property = file.substring(0,i);
|
||||
String value = fixPath(file.substring(i + 1));
|
||||
debug(" " + property + "=" + value);
|
||||
System.setProperty(property,value);
|
||||
}
|
||||
else
|
||||
// Add all unconsidered JAR and ZIP files to classpath
|
||||
if (subject.endsWith("/*"))
|
||||
{
|
||||
// directory of JAR files - only add jars and zips within the directory
|
||||
File dir = new File(fixPath(file.substring(0,file.length() - 1)));
|
||||
addJars(sections,dir,false);
|
||||
}
|
||||
else
|
||||
// Recursively add all unconsidered JAR and ZIP files to classpath
|
||||
if (subject.endsWith("/**"))
|
||||
{
|
||||
//directory hierarchy of jar files - recursively add all jars and zips in the hierarchy
|
||||
File dir = new File(fixPath(file.substring(0,file.length() - 2)));
|
||||
addJars(sections,dir,true);
|
||||
}
|
||||
else
|
||||
// Add raw classpath directory to classpath
|
||||
if (subject.endsWith("/"))
|
||||
{
|
||||
// class directory
|
||||
File cd = new File(fixPath(file));
|
||||
String d = cd.getCanonicalPath();
|
||||
boolean added = addClasspathComponent(sections,d);
|
||||
debug((added?" CLASSPATH+=":" !") + d);
|
||||
}
|
||||
else
|
||||
// Add XML configuration
|
||||
if (subject.toLowerCase().endsWith(".xml"))
|
||||
{
|
||||
// Config file
|
||||
File f = new File(fixPath(file));
|
||||
if (f.exists())
|
||||
_xml.add(f.getCanonicalPath());
|
||||
debug(" ARGS+=" + f);
|
||||
}
|
||||
else
|
||||
// Set the main class to execute (overrides any previously set)
|
||||
if (subject.toLowerCase().endsWith(".class"))
|
||||
{
|
||||
// Class
|
||||
String cn = expand(subject.substring(0,subject.length() - 6));
|
||||
if (cn != null && cn.length() > 0)
|
||||
// Setting of start property with canonical path
|
||||
if (subject.indexOf("/=") > 0)
|
||||
{
|
||||
debug(" CLASS=" + cn);
|
||||
_classname = cn;
|
||||
int i = file.indexOf("/=");
|
||||
String property = file.substring(0,i);
|
||||
String value = fixPath(file.substring(i + 2));
|
||||
String canonical = new File(value).getCanonicalPath();
|
||||
debug(" " + property + "/=" + value + "==" + canonical);
|
||||
setProperty(property,canonical);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Add raw classpath entry
|
||||
if (subject.toLowerCase().endsWith(".path"))
|
||||
{
|
||||
// classpath (jetty.class.path?) to add to runtime classpath
|
||||
String cn = expand(subject.substring(0,subject.length() - 5));
|
||||
if (cn != null && cn.length() > 0)
|
||||
{
|
||||
debug(" PATH=" + cn);
|
||||
addClasspathPath(sections,cn);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Add Security Policy file reference
|
||||
if (subject.toLowerCase().endsWith(".policy"))
|
||||
{
|
||||
//policy file to parse
|
||||
String cn = expand(subject.substring(0,subject.length()));
|
||||
if (cn != null && cn.length() > 0)
|
||||
{
|
||||
debug(" POLICY=" + cn);
|
||||
_policies.add(fixPath(cn));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single JAR file
|
||||
File f = new File(fixPath(file));
|
||||
if (f.exists())
|
||||
{
|
||||
String d = f.getCanonicalPath();
|
||||
boolean added = addClasspathComponent(sections,d);
|
||||
if (!added)
|
||||
else
|
||||
// Setting of system property
|
||||
if (subject.indexOf("=") > 0)
|
||||
{
|
||||
added = addClasspathPath(sections,expand(subject));
|
||||
int i = file.indexOf("=");
|
||||
String property = file.substring(0,i);
|
||||
String value = fixPath(file.substring(i + 1));
|
||||
debug(" " + property + "=" + value);
|
||||
System.setProperty(property,value);
|
||||
}
|
||||
debug((added?" CLASSPATH+=":" !") + d);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Add all unconsidered JAR and ZIP files to classpath
|
||||
if (subject.endsWith("/*"))
|
||||
{
|
||||
// directory of JAR files - only add jars and zips within the directory
|
||||
File dir = new File(fixPath(file.substring(0,file.length() - 1)));
|
||||
addJars(sections,dir,false);
|
||||
}
|
||||
else
|
||||
// Recursively add all unconsidered JAR and ZIP files to classpath
|
||||
if (subject.endsWith("/**"))
|
||||
{
|
||||
//directory hierarchy of jar files - recursively add all jars and zips in the hierarchy
|
||||
File dir = new File(fixPath(file.substring(0,file.length() - 2)));
|
||||
addJars(sections,dir,true);
|
||||
}
|
||||
else
|
||||
// Add raw classpath directory to classpath
|
||||
if (subject.endsWith("/"))
|
||||
{
|
||||
// class directory
|
||||
File cd = new File(fixPath(file));
|
||||
String d = cd.getCanonicalPath();
|
||||
boolean added = addClasspathComponent(sections,d);
|
||||
debug((added?" CLASSPATH+=":" !") + d);
|
||||
}
|
||||
else
|
||||
// Add XML configuration
|
||||
if (subject.toLowerCase().endsWith(".xml"))
|
||||
{
|
||||
// Config file
|
||||
File f = new File(fixPath(file));
|
||||
if (f.exists())
|
||||
_xml.add(f.getCanonicalPath());
|
||||
debug(" ARGS+=" + f);
|
||||
}
|
||||
else
|
||||
// Set the main class to execute (overrides any previously set)
|
||||
if (subject.toLowerCase().endsWith(".class"))
|
||||
{
|
||||
// Class
|
||||
String cn = expand(subject.substring(0,subject.length() - 6));
|
||||
if (cn != null && cn.length() > 0)
|
||||
{
|
||||
debug(" CLASS=" + cn);
|
||||
_classname = cn;
|
||||
}
|
||||
}
|
||||
else
|
||||
// Add raw classpath entry
|
||||
if (subject.toLowerCase().endsWith(".path"))
|
||||
{
|
||||
// classpath (jetty.class.path?) to add to runtime classpath
|
||||
String cn = expand(subject.substring(0,subject.length() - 5));
|
||||
if (cn != null && cn.length() > 0)
|
||||
{
|
||||
debug(" PATH=" + cn);
|
||||
addClasspathPath(sections,cn);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Add Security Policy file reference
|
||||
if (subject.toLowerCase().endsWith(".policy"))
|
||||
{
|
||||
//policy file to parse
|
||||
String cn = expand(subject.substring(0,subject.length()));
|
||||
if (cn != null && cn.length() > 0)
|
||||
{
|
||||
debug(" POLICY=" + cn);
|
||||
_policies.add(fixPath(cn));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single JAR file
|
||||
File f = new File(fixPath(file));
|
||||
if (f.exists())
|
||||
{
|
||||
String d = f.getCanonicalPath();
|
||||
boolean added = addClasspathComponent(sections,d);
|
||||
if (!added)
|
||||
{
|
||||
added = addClasspathPath(sections,expand(subject));
|
||||
}
|
||||
debug((added?" CLASSPATH+=":" !") + d);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -799,11 +804,11 @@ public class Config
|
|||
}
|
||||
|
||||
public Policy getPolicyInstance(ClassLoader cl) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException,
|
||||
InstantiationException, IllegalAccessException, InvocationTargetException
|
||||
InstantiationException, IllegalAccessException, InvocationTargetException
|
||||
{
|
||||
Class<?> jettyPolicy = cl.loadClass("org.eclipse.jetty.policy.JettyPolicy");
|
||||
Constructor<?> c = jettyPolicy.getConstructor(new Class[]
|
||||
{ Set.class, Map.class });
|
||||
{ Set.class, Map.class });
|
||||
Object policyClass = c.newInstance(_policies,_properties);
|
||||
|
||||
if (policyClass instanceof Policy)
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
|
@ -16,11 +16,13 @@ import java.io.BufferedReader;
|
|||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -33,6 +35,9 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.jetty.start.log.RedirectedStreamLogger;
|
||||
|
||||
/*-------------------------------------------*/
|
||||
/**
|
||||
|
@ -53,6 +58,7 @@ public class Main
|
|||
private boolean _listModes = false;
|
||||
private boolean _execPrint = false;
|
||||
private boolean _secure = false;
|
||||
private boolean _fromDaemon = false;
|
||||
private List<String> _activeOptions = new ArrayList<String>();
|
||||
private Config _config = new Config();
|
||||
|
||||
|
@ -103,7 +109,7 @@ public class Main
|
|||
_dumpVersions = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ("--list-modes".equals(arg))
|
||||
{
|
||||
_listModes = true;
|
||||
|
@ -115,13 +121,23 @@ public class Main
|
|||
_execPrint = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Special internal indicator that jetty was started by the jetty.sh Daemon
|
||||
if ("--fromDaemon".equals(arg))
|
||||
{
|
||||
_fromDaemon = true;
|
||||
PrintStream logger = new PrintStream(new RedirectedStreamLogger("daemon_yyyy_mm_dd.log",false,90,TimeZone.getTimeZone("GMT")));
|
||||
System.setOut(logger);
|
||||
System.setErr(logger);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("--secure".equals(arg))
|
||||
{
|
||||
_secure = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Process property spec
|
||||
if (arg.indexOf('=') >= 0)
|
||||
{
|
||||
|
@ -230,7 +246,7 @@ public class Main
|
|||
}
|
||||
}
|
||||
else
|
||||
// Nah, it's a normal property
|
||||
// Nah, it's a normal property
|
||||
{
|
||||
String[] assign = arg.split("=",2);
|
||||
|
||||
|
@ -245,7 +261,7 @@ public class Main
|
|||
}
|
||||
}
|
||||
else
|
||||
// A normal argument
|
||||
// A normal argument
|
||||
{
|
||||
args.add(arg);
|
||||
}
|
||||
|
@ -369,7 +385,7 @@ public class Main
|
|||
}
|
||||
|
||||
public void invokeMain(ClassLoader classloader, String classname, List<String> args) throws IllegalAccessException, InvocationTargetException,
|
||||
NoSuchMethodException, ClassNotFoundException
|
||||
NoSuchMethodException, ClassNotFoundException
|
||||
{
|
||||
Class<?> invoked_class = null;
|
||||
|
||||
|
@ -399,11 +415,11 @@ public class Main
|
|||
String argArray[] = args.toArray(new String[0]);
|
||||
|
||||
Class<?>[] method_param_types = new Class[]
|
||||
{ String.class };
|
||||
{ argArray.getClass() };
|
||||
|
||||
Method main = invoked_class.getDeclaredMethod("main",method_param_types);
|
||||
Object[] method_params = new Object[]
|
||||
{ argArray };
|
||||
{ argArray };
|
||||
|
||||
main.invoke(null,method_params);
|
||||
}
|
||||
|
@ -443,21 +459,18 @@ public class Main
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void start(List<String> xmls)
|
||||
public void start(List<String> xmls) throws FileNotFoundException
|
||||
{
|
||||
// Setup Start / Stop Monitoring
|
||||
startMonitor();
|
||||
|
||||
// Initialize the Config (start.config)
|
||||
initConfig(xmls);
|
||||
|
||||
// Default options (if not specified)
|
||||
if (_activeOptions.isEmpty())
|
||||
{
|
||||
_activeOptions.add("default");
|
||||
_activeOptions.add("*");
|
||||
}
|
||||
|
||||
|
||||
// Add mandatory options for secure mode
|
||||
if (_secure)
|
||||
{
|
||||
|
@ -465,7 +478,25 @@ public class Main
|
|||
addMandatoryOption("security");
|
||||
}
|
||||
|
||||
// Get Desired Classpath
|
||||
// Default XMLs (if not specified)
|
||||
if (xmls.isEmpty())
|
||||
{
|
||||
// Do not rely on _jettyHome yet, as initConfig(xmls) defines _jettyHome, and
|
||||
// resolveXmlConfigs(xmls) normalizes the xmls based off it.
|
||||
if (_fromDaemon)
|
||||
{
|
||||
xmls.add("etc/jetty-logging.xml");
|
||||
}
|
||||
xmls.add("etc/jetty.xml");
|
||||
}
|
||||
|
||||
// Initialize the Config (start.config)
|
||||
initConfig(xmls);
|
||||
|
||||
// Normalize the XML config options passed on the command line.
|
||||
xmls = resolveXmlConfigs(xmls);
|
||||
|
||||
// Get Desired Classpath based on user provided Active Options.
|
||||
Classpath classpath = _config.getCombinedClasspath(_activeOptions);
|
||||
|
||||
System.setProperty("java.class.path",classpath.toString());
|
||||
|
@ -494,14 +525,14 @@ public class Main
|
|||
showClasspathWithVersions(classpath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Show all modes with version information
|
||||
if (_listModes)
|
||||
{
|
||||
showAllModesWithVersions(classpath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Show Command Line to execute Jetty
|
||||
if (_execPrint)
|
||||
{
|
||||
|
@ -541,6 +572,29 @@ public class Main
|
|||
}
|
||||
}
|
||||
|
||||
private String resolveXmlConfig(String xmlFilename) throws FileNotFoundException
|
||||
{
|
||||
File xml = new File(xmlFilename);
|
||||
if (xml.exists() && xml.isFile())
|
||||
{
|
||||
return xml.getAbsolutePath();
|
||||
}
|
||||
|
||||
xml = new File(_jettyHome,fixPath(xmlFilename));
|
||||
if (xml.exists() && xml.isFile())
|
||||
{
|
||||
return xml.getAbsolutePath();
|
||||
}
|
||||
|
||||
xml = new File(_jettyHome,fixPath("etc/" + xmlFilename));
|
||||
if (xml.exists() && xml.isFile())
|
||||
{
|
||||
return xml.getAbsolutePath();
|
||||
}
|
||||
|
||||
throw new FileNotFoundException("Unable to find XML Config: " + xmlFilename);
|
||||
}
|
||||
|
||||
private void addMandatoryOption(String id)
|
||||
{
|
||||
if (!_activeOptions.contains(id))
|
||||
|
@ -552,7 +606,7 @@ public class Main
|
|||
private void showExecPrint(Classpath classpath, List<String> xmls)
|
||||
{
|
||||
StringBuffer cmd = new StringBuffer();
|
||||
|
||||
|
||||
cmd.append(findJavaBin());
|
||||
cmd.append(" -cp ").append(classpath.toString());
|
||||
cmd.append(" -Djetty.home=").append(_jettyHome);
|
||||
|
@ -564,7 +618,7 @@ public class Main
|
|||
|
||||
System.out.println(cmd);
|
||||
}
|
||||
|
||||
|
||||
private String findJavaBin()
|
||||
{
|
||||
File javaHome = new File(System.getProperty("java.home"));
|
||||
|
@ -648,16 +702,16 @@ public class Main
|
|||
System.out.println();
|
||||
}
|
||||
System.out.println("-------------------------------------------------------------");
|
||||
|
||||
|
||||
Classpath sectionCP = _config.getSectionClasspath(sectionId);
|
||||
|
||||
|
||||
if (sectionCP.isEmpty())
|
||||
{
|
||||
System.out.println("Empty mode, no classpath entries active.");
|
||||
System.out.println();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (File element : sectionCP.getElements())
|
||||
{
|
||||
|
@ -668,7 +722,7 @@ public class Main
|
|||
}
|
||||
System.out.printf("%2d: %20s | %s\n",i++,getVersion(element),elementPath);
|
||||
}
|
||||
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
@ -701,10 +755,10 @@ public class Main
|
|||
System.out.printf("%2d: %20s | %s\n",i++,getVersion(element),elementPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String fixPath(String path)
|
||||
{
|
||||
return path.replace('/',File.separatorChar);
|
||||
return path.replace('/',File.separatorChar);
|
||||
}
|
||||
|
||||
private String getVersion(File element)
|
||||
|
@ -760,6 +814,17 @@ public class Main
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> resolveXmlConfigs(List<String> xmls) throws FileNotFoundException
|
||||
{
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (String xml : xmls)
|
||||
{
|
||||
ret.add(resolveXmlConfig(xml));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void initConfig(List<String> xmls)
|
||||
{
|
||||
InputStream cfgstream = null;
|
||||
|
|
|
@ -0,0 +1,298 @@
|
|||
package org.eclipse.jetty.start.log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilterOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class RedirectedStreamLogger extends FilterOutputStream
|
||||
{
|
||||
private static Timer __rollover;
|
||||
|
||||
final static String YYYY_MM_DD = "yyyy_mm_dd";
|
||||
|
||||
private RollTask _rollTask;
|
||||
private SimpleDateFormat _fileBackupFormat;
|
||||
private SimpleDateFormat _fileDateFormat;
|
||||
|
||||
private String _filename;
|
||||
private File _file;
|
||||
private boolean _append;
|
||||
private int _retainDays;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filename
|
||||
* The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when
|
||||
* creating and rolling over the file.
|
||||
* @throws IOException
|
||||
*/
|
||||
public RedirectedStreamLogger(String filename) throws IOException
|
||||
{
|
||||
this(filename,true,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filename
|
||||
* The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when
|
||||
* creating and rolling over the file.
|
||||
* @param append
|
||||
* If true, existing files will be appended to.
|
||||
* @throws IOException
|
||||
*/
|
||||
public RedirectedStreamLogger(String filename, boolean append) throws IOException
|
||||
{
|
||||
this(filename,append,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filename
|
||||
* The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when
|
||||
* creating and rolling over the file.
|
||||
* @param append
|
||||
* If true, existing files will be appended to.
|
||||
* @param retainDays
|
||||
* The number of days to retain files before deleting them. 0 to retain forever.
|
||||
* @throws IOException
|
||||
*/
|
||||
public RedirectedStreamLogger(String filename, boolean append, int retainDays) throws IOException
|
||||
{
|
||||
this(filename,append,retainDays,TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filename
|
||||
* The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when
|
||||
* creating and rolling over the file.
|
||||
* @param append
|
||||
* If true, existing files will be appended to.
|
||||
* @param retainDays
|
||||
* The number of days to retain files before deleting them. 0 to retain forever.
|
||||
* @throws IOException
|
||||
*/
|
||||
public RedirectedStreamLogger(String filename, boolean append, int retainDays, TimeZone zone) throws IOException
|
||||
{
|
||||
this(filename,append,retainDays,zone,null,null);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param filename
|
||||
* The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when
|
||||
* creating and rolling over the file.
|
||||
* @param append
|
||||
* If true, existing files will be appended to.
|
||||
* @param retainDays
|
||||
* The number of days to retain files before deleting them. 0 to retain forever.
|
||||
* @param dateFormat
|
||||
* The format for the date file substitution. If null the system property ROLLOVERFILE_DATE_FORMAT is
|
||||
* used and if that is null, then default is "yyyy_MM_dd".
|
||||
* @param backupFormat
|
||||
* The format for the file extension of backup files. If null the system property
|
||||
* ROLLOVERFILE_BACKUP_FORMAT is used and if that is null, then default is "HHmmssSSS".
|
||||
* @throws IOException
|
||||
*/
|
||||
public RedirectedStreamLogger(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat) throws IOException
|
||||
{
|
||||
super(null);
|
||||
|
||||
if (dateFormat == null)
|
||||
dateFormat = System.getProperty("ROLLOVERFILE_DATE_FORMAT","yyyy_MM_dd");
|
||||
_fileDateFormat = new SimpleDateFormat(dateFormat);
|
||||
|
||||
if (backupFormat == null)
|
||||
backupFormat = System.getProperty("ROLLOVERFILE_BACKUP_FORMAT","HHmmssSSS");
|
||||
_fileBackupFormat = new SimpleDateFormat(backupFormat);
|
||||
|
||||
_fileBackupFormat.setTimeZone(zone);
|
||||
_fileDateFormat.setTimeZone(zone);
|
||||
|
||||
if (filename != null)
|
||||
{
|
||||
filename = filename.trim();
|
||||
if (filename.length() == 0)
|
||||
filename = null;
|
||||
}
|
||||
if (filename == null)
|
||||
throw new IllegalArgumentException("Invalid filename");
|
||||
|
||||
_filename = filename;
|
||||
_append = append;
|
||||
_retainDays = retainDays;
|
||||
setFile();
|
||||
|
||||
synchronized (RedirectedStreamLogger.class)
|
||||
{
|
||||
if (__rollover == null)
|
||||
__rollover = new Timer(RedirectedStreamLogger.class.getName(),true);
|
||||
|
||||
_rollTask = new RollTask();
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.setTimeZone(zone);
|
||||
|
||||
GregorianCalendar midnight = new GregorianCalendar(now.get(Calendar.YEAR),now.get(Calendar.MONTH),now.get(Calendar.DAY_OF_MONTH),23,0);
|
||||
midnight.setTimeZone(zone);
|
||||
midnight.add(Calendar.HOUR,1);
|
||||
__rollover.scheduleAtFixedRate(_rollTask,midnight.getTime(),1000L * 60 * 60 * 24);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String getFilename()
|
||||
{
|
||||
return _filename;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String getDatedFilename()
|
||||
{
|
||||
if (_file == null)
|
||||
return null;
|
||||
return _file.toString();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public int getRetainDays()
|
||||
{
|
||||
return _retainDays;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
private synchronized void setFile() throws IOException
|
||||
{
|
||||
// Check directory
|
||||
File file = new File(_filename);
|
||||
_filename = file.getCanonicalPath();
|
||||
file = new File(_filename);
|
||||
File dir = new File(file.getParent());
|
||||
if (!dir.isDirectory() || !dir.canWrite())
|
||||
throw new IOException("Cannot write log directory " + dir);
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
// Is this a rollover file?
|
||||
String filename = file.getName();
|
||||
int i = filename.toLowerCase().indexOf(YYYY_MM_DD);
|
||||
if (i >= 0)
|
||||
{
|
||||
file = new File(dir,filename.substring(0,i) + _fileDateFormat.format(now) + filename.substring(i + YYYY_MM_DD.length()));
|
||||
}
|
||||
|
||||
if (file.exists() && !file.canWrite())
|
||||
throw new IOException("Cannot write log file " + file);
|
||||
|
||||
// Do we need to change the output stream?
|
||||
if (out == null || !file.equals(_file))
|
||||
{
|
||||
// Yep
|
||||
_file = file;
|
||||
if (!_append && file.exists())
|
||||
file.renameTo(new File(file.toString() + "." + _fileBackupFormat.format(now)));
|
||||
OutputStream oldOut = out;
|
||||
out = new FileOutputStream(file.toString(),_append);
|
||||
if (oldOut != null)
|
||||
oldOut.close();
|
||||
//if(log.isDebugEnabled())log.debug("Opened "+_file);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
private void removeOldFiles()
|
||||
{
|
||||
if (_retainDays > 0)
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
File file = new File(_filename);
|
||||
File dir = new File(file.getParent());
|
||||
String fn = file.getName();
|
||||
int s = fn.toLowerCase().indexOf(YYYY_MM_DD);
|
||||
if (s < 0)
|
||||
return;
|
||||
String prefix = fn.substring(0,s);
|
||||
String suffix = fn.substring(s + YYYY_MM_DD.length());
|
||||
|
||||
String[] logList = dir.list();
|
||||
for (int i = 0; i < logList.length; i++)
|
||||
{
|
||||
fn = logList[i];
|
||||
if (fn.startsWith(prefix) && fn.indexOf(suffix,prefix.length()) >= 0)
|
||||
{
|
||||
File f = new File(dir,fn);
|
||||
long date = f.lastModified();
|
||||
if (((now - date) / (1000 * 60 * 60 * 24)) > _retainDays)
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void write(byte[] buf) throws IOException
|
||||
{
|
||||
out.write(buf);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void write(byte[] buf, int off, int len) throws IOException
|
||||
{
|
||||
out.write(buf,off,len);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
synchronized (RedirectedStreamLogger.class)
|
||||
{
|
||||
try
|
||||
{
|
||||
super.close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
out = null;
|
||||
_file = null;
|
||||
}
|
||||
|
||||
_rollTask.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
private class RollTask extends TimerTask
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
RedirectedStreamLogger.this.setFile();
|
||||
RedirectedStreamLogger.this.removeOldFiles();
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,6 +40,9 @@ NOTE: Not all properties are listed here.
|
|||
STOP.KEY=[alphanumeric]
|
||||
The passphrase defined to stop the server.
|
||||
Requried along with STOP.PORT if you want to use the --stop option above.
|
||||
DEBUG=true
|
||||
Enable debug level log messages on the default logging implementation.
|
||||
(default: false)
|
||||
OPTIONS=[mode,mode,...]
|
||||
Classpath Options to use. Eg: All, Server, jmx, webapp, plus, etc...
|
||||
(default: "default,*")
|
||||
|
|
Loading…
Reference in New Issue