You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You've created a Java function app with a simple HTTP trigger and deployed it to Azure Functions.
177
203
178
204
- Review the [Java Functions developer guide](functions-reference-java.md) for more information on developing Java functions.
179
205
- Add additional functions with different triggers to your project using the `azure-functions:add` Maven target.
180
-
- Debug functions locally with Visual Studio Code. With the [Java extension pack](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) installed and with your Functions project open in Visual Studio Code, [attach the debugger](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations) to port 5005. Then set a breakpoint in the editor and trigger your function while it's running locally:
181
-

182
-
- Debug functions remotely with Visual Studio Code. Check the [Writing serverless Java Applications](https://code.visualstudio.com/docs/java/java-serverless#_remote-debug-functions-running-in-the-cloud) documentation for instructions.
206
+
- Write and debug functions locally with [Visual Studio Code](https://code.visualstudio.com/docs/java/java-azurefunctions), [IntelliJ](functions-create-maven-intellij.md), and [Eclipse](functions-create-maven-eclipse.md).
207
+
- Debug functions deployed in Azure with Visual Studio Code. See the Visual Studio Code [serverless Java applications](https://code.visualstudio.com/docs/java/java-serverless#_remote-debug-functions-running-in-the-cloud) documentation for instructions.
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-reference-java.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ with the corresponding `function.json`:
88
88
89
89
Azure Functions supports the use of third-party libraries. By default, all dependencies specified in your project `pom.xml` file will be automatically bundled during the `mvn package` goal. For libraries not specified as dependencies in the `pom.xml` file, place them in a `lib` directory in the function's root directory. Dependencies placed in the `lib` directory will be added to the system class loader at runtime.
90
90
91
-
## Data Types
91
+
## Data type support
92
92
93
93
You can use any data types in Java for the input and output data, including native types; customized Java types and specialized Azure types defined in `azure-functions-java-library` package. The Azure Functions runtime attempts convert the input received into the type requested by your code.
94
94
@@ -238,7 +238,7 @@ public class MyClass {
238
238
239
239
Interact with Azure Functions execution environment via the `ExecutionContext` object defined in the `azure-functions-java-library` package. Use the `ExecutionContext` object to use invocation information and functions runtime information in your code.
240
240
241
-
### Logging
241
+
### Custom logging
242
242
243
243
Access to the Functions runtime logger is available through the `ExecutionContext` object. This logger is tied to the Azure monitor and allows you to flag warnings and errors encountered during function execution.
244
244
@@ -259,6 +259,29 @@ public class Function {
259
259
}
260
260
```
261
261
262
+
## View logs and trace
263
+
264
+
You can use the Azure CLI to stream Java standard out and error logging as well as other application logging. First, Configure your Function application to write application logging using the Azure CLI:
265
+
266
+
```azurecli-interactive
267
+
az webapp log config --name functionname --resource-group myResourceGroup --application-logging true
268
+
```
269
+
270
+
To stream logging output for your Function app using the Azure CLI, open a new command prompt, Bash, or Terminal session and enter the following command:
271
+
272
+
```azurecli-interactive
273
+
az webapp log tail --name webappname --resource-group myResourceGroup
274
+
```
275
+
The [az webapp log tail](/cli/azure/webapp/log) command has options to filter output using the `--provider` option.
276
+
277
+
To download the log files as a single ZIP file using the Azure CLI, open a new command prompt, Bash, or Terminal session and enter the following command:
278
+
279
+
```azurecli-interactive
280
+
az webapp log download --resource-group resourcegroupname --name functionappname
281
+
```
282
+
283
+
You must have enabled file system logging in the Azure Portal or Azure CLI before running this command.
284
+
262
285
## Environment variables
263
286
264
287
Keep secret information such as keys or tokens out of your source code for security reasons. Use keys and tokens in your function code by reading them from environment variables.
@@ -283,9 +306,12 @@ Each key / value mapping in the `values` map will be made available at runtime a
283
306
With your code now depending on these environment variables, you can sign in to the Azure portal to set the same key / value pairs in your function app settings, so that your code functions equivalently when testing locally and when deployed to Azure.
284
307
285
308
## Next steps
286
-
For more information, see the following resources:
309
+
310
+
For more information about Azure Function Java development, see the following resources:
287
311
288
312
*[Best practices for Azure Functions](functions-best-practices.md)
*[Azure Functions triggers and bindings](functions-triggers-bindings.md)
315
+
- Local development and debug with [Visual Studio Code](https://code.visualstudio.com/docs/java/java-azurefunctions), [IntelliJ](functions-create-maven-intellij.md), and [Eclipse](functions-create-maven-eclipse.md).
291
316
*[Remote Debug Java Azure Functions with Visual Studio Code](https://code.visualstudio.com/docs/java/java-serverless#_remote-debug-functions-running-in-the-cloud)
317
+
*[Maven plugin for Azure Functions](https://github.com/Microsoft/azure-maven-plugins/blob/develop/azure-functions-maven-plugin/README.md) - Streamline function creation through the `azure-functions:add` goal and prepare a staging directory for [ZIP file deployment](deployment-zip-push.md).
0 commit comments