在 Liberty 中的 server.env 中设置环境值,从 Tomcat 中的 setenv.sh 移动
Setting environment values in server.env in Liberty moving from setenv.sh in Tomcat
我正从 Apache tomcat 迁移到 Liberty 服务器。在我的 tomcat 服务器中,我有一个 setenv 文件,我在其中设置了
的值
CATALINA_OPT=" \
-Dlog4j.configuration=file:$PROJECT_ROOT/log4j.properties \
-Darchs.depl.applicationId=tester"
我无法弄清楚 Liberty 中 server.env 文件中的相应设置应该是什么。
我试过:
-Dlog4j.configuration=file:$PROJECT_ROOT/log4j.properties
-Darchs.depl.applicationId=tester
启动时出现错误:
eval: -D: invalid option
eval: usage: eval [arg ...]
server.env 文件只支持键值对。
如果您想设置 JVM 参数,请改用 jvm.options 文件。
示例 jvm.options 语法(来自 IBM doc):
# Set the maximum heap size to 1024m.
-Xmx1024m
# Set a system property.
-Dcom.ibm.example.system.property=ExampleValue
# Enable verbose output for class loading.
-verbose:class
# Enable verbose garbage collection.
-verbose:gc
# Specify an alternate verbose garbage collection log on IBM Java Virtual Machines only.
-Xverbosegclog:verbosegc.log
# Specify additional verbose garbage collection options on HotSpot Java Virtual Machines only.
-Xloggc:verbosegc.log
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintHeapAtGC
可以放置 jvm.options 文件的位置(同样来自 IBM 文档):
The server management script searches for jvm.options in two locations: ${wlp.install.dir}/etc/jvm.options
and ${server.config.dir}/jvm.options
. If both files are present, the options in the ${server.config.dir}/jvm.options
file are used.
我正从 Apache tomcat 迁移到 Liberty 服务器。在我的 tomcat 服务器中,我有一个 setenv 文件,我在其中设置了
的值CATALINA_OPT=" \
-Dlog4j.configuration=file:$PROJECT_ROOT/log4j.properties \
-Darchs.depl.applicationId=tester"
我无法弄清楚 Liberty 中 server.env 文件中的相应设置应该是什么。
我试过:
-Dlog4j.configuration=file:$PROJECT_ROOT/log4j.properties
-Darchs.depl.applicationId=tester
启动时出现错误:
eval: -D: invalid option
eval: usage: eval [arg ...]
server.env 文件只支持键值对。
如果您想设置 JVM 参数,请改用 jvm.options 文件。
示例 jvm.options 语法(来自 IBM doc):
# Set the maximum heap size to 1024m.
-Xmx1024m
# Set a system property.
-Dcom.ibm.example.system.property=ExampleValue
# Enable verbose output for class loading.
-verbose:class
# Enable verbose garbage collection.
-verbose:gc
# Specify an alternate verbose garbage collection log on IBM Java Virtual Machines only.
-Xverbosegclog:verbosegc.log
# Specify additional verbose garbage collection options on HotSpot Java Virtual Machines only.
-Xloggc:verbosegc.log
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintHeapAtGC
可以放置 jvm.options 文件的位置(同样来自 IBM 文档):
The server management script searches for jvm.options in two locations:
${wlp.install.dir}/etc/jvm.options
and${server.config.dir}/jvm.options
. If both files are present, the options in the${server.config.dir}/jvm.options
file are used.