Skip to content

Commit 25087df

Browse files
Merge pull request #264407 from fmustaf/master
Update configure-language-java.md
2 parents 0b422cf + e81dfd1 commit 25087df

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

articles/app-service/configure-language-java.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,85 @@ You don't need to incrementally add instances (scaling out), you can add multipl
10861086
10871087
JBoss EAP is only available on the Premium v3 and Isolated v2 App Service Plan types. Customers that created a JBoss EAP site on a different tier during the public preview should scale up to Premium or Isolated hardware tier to avoid unexpected behavior.
10881088
1089+
## Tomcat Baseline Configuration On App Services
1090+
1091+
Java developers can customize the server settings, troubleshoot issues, and deploy applications to Tomcat with confidence if they know about the server.xml file and configuration details of Tomcat. Some of these may be:
1092+
* Customizing Tomcat configuration: By understanding the server.xml file and Tomcat's configuration details, developers can fine-tune the server settings to match the needs of their applications.
1093+
* Debugging: When an application is deployed on a Tomcat server, developers need to know the server configuration to debug any issues that may arise. This includes checking the server logs, examining the configuration files, and identifying any errors that might be occurring.
1094+
* Troubleshooting Tomcat issues: Inevitably, Java developers will encounter issues with their Tomcat server, such as performance problems or configuration errors. By understanding the server.xml file and Tomcat's configuration details, developers can quickly diagnose and troubleshoot these issues, which can save time and effort.
1095+
* Deploying applications to Tomcat: To deploy a Java web application to Tomcat, developers need to know how to configure the server.xml file and other Tomcat settings. Understanding these details is essential for deploying applications successfully and ensuring that they run smoothly on the server.
1096+
1097+
As you provision an App Service with Tomcat to host your Java workload (a WAR file or a JAR file), there are certain settings that you get out of the box for Tomcat configuration. You can refer to the [Official Apache Tomcat Documentation](https://tomcat.apache.org/) for detailed information, including the default configuration for Tomcat Web Server.
1098+
1099+
Additionally, there are certain transformations that are further applied on top of the server.xml for Tomcat distribution upon start. These are transformations to the Connector, Host, and Valve settings.
1100+
1101+
Please note that the latest versions of Tomcat will have these server.xml. (8.5.58 and 9.0.38 onward). Older versions of Tomcat do not use transforms and may have different behavior as a result.
1102+
1103+
### Connector
1104+
1105+
```xml
1106+
<Connector port="${port.http}" address="127.0.0.1" maxHttpHeaderSize="16384" compression="on" URIEncoding="UTF-8" connectionTimeout="${site.connectionTimeout}" maxThreads="${catalina.maxThreads}" maxConnections="${catalina.maxConnections}" protocol="HTTP/1.1" redirectPort="8443"/>
1107+
```
1108+
* `maxHttpHeaderSize` is set to `16384`
1109+
* `URIEncoding` is set to `UTF-8`
1110+
* `conectionTimeout` is set to `WEBSITE_TOMCAT_CONNECTION_TIMEOUT`, which defaults to `240000`
1111+
* `maxThreads` is set to `WEBSITE_CATALINA_MAXTHREADS`, which defaults to `200`
1112+
* `maxConnections` is set to `WEBSITE_CATALINA_MAXCONNECTIONS`, which defaults to `10000`
1113+
1114+
> [!NOTE]
1115+
> The connectionTimeout, maxThreads and maxConnections settings can be tuned with app settings
1116+
1117+
Following are example CLI commands that you may use to alter the values of conectionTimeout, maxThreads, or maxConnections:
1118+
1119+
```azurecli-interactive
1120+
az webapp config appsettings set --resource-group myResourceGroup --name myApp --settings WEBSITE_TOMCAT_CONNECTION_TIMEOUT=120000
1121+
```
1122+
```azurecli-interactive
1123+
az webapp config appsettings set --resource-group myResourceGroup --name myApp --settings WEBSITE_CATALINA_MAXTHREADS=100
1124+
```
1125+
```azurecli-interactive
1126+
az webapp config appsettings set --resource-group myResourceGroup --name myApp --settings WEBSITE_CATALINA_MAXCONNECTIONS=5000
1127+
```
1128+
* Connector uses the address of the container instead of 127.0.0.1
1129+
1130+
### Host
1131+
1132+
```xml
1133+
<Host appBase="${site.appbase}" xmlBase="${site.xmlbase}" unpackWARs="${site.unpackwars}" workDir="${site.tempdir}" errorReportValveClass="com.microsoft.azure.appservice.AppServiceErrorReportValve" name="localhost" autoDeploy="true">
1134+
```
1135+
1136+
* `appBase` is set to `AZURE_SITE_APP_BASE`, which defaults to local `WebappsLocalPath`
1137+
* `xmlBase` is set to `AZURE_SITE_HOME`, which defaults to `/site/wwwroot`
1138+
* `unpackWARs` is set to `AZURE_UNPACK_WARS`, which defaults to `true`
1139+
* `workDir` is set to `JAVA_TMP_DIR`, which defaults `TMP`
1140+
* errorReportValveClass uses our custom error report valve
1141+
1142+
### Valve
1143+
1144+
```xml
1145+
<Valve prefix="site_access_log.${catalina.instance.name}" pattern="%h %l %u %t &quot;%r&quot; %s %b %D %{x-arr-log-id}i" directory="${site.logdir}/http/RawLogs" maxDays="${site.logRetentionDays}" className="org.apache.catalina.valves.AccessLogValve" suffix=".txt"/>
1146+
```
1147+
* `directory` is set to `AZURE_LOGGING_DIR`, which defaults to `home\logFiles`
1148+
* `maxDays` is to `WEBSITE_HTTPLOGGING_RETENTION_DAYS`, which defaults to `0` [forever]
1149+
1150+
On Linux, it has all of the same customization, plus:
1151+
1152+
* Adds some error and reporting pages to the valve:
1153+
```xml
1154+
<xsl:attribute name="appServiceErrorPage">
1155+
<xsl:value-of select="'${appService.valves.appServiceErrorPage}'"/>
1156+
</xsl:attribute>
1157+
1158+
<xsl:attribute name="showReport">
1159+
<xsl:value-of select="'${catalina.valves.showReport}'"/>
1160+
</xsl:attribute>
1161+
1162+
<xsl:attribute name="showServerInfo">
1163+
<xsl:value-of select="'${catalina.valves.showServerInfo}'"/>
1164+
</xsl:attribute>
1165+
```
1166+
1167+
10891168
::: zone-end
10901169
10911170
## Next steps

0 commit comments

Comments
 (0)