Skip to content

Commit 8a259fb

Browse files
committed
add logs and trace to developer guide
1 parent 6a9a272 commit 8a259fb

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

articles/azure-functions/functions-reference-java.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ with the corresponding `function.json`:
8888

8989
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.
9090

91-
## Data Types
91+
## Data type support
9292

9393
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.
9494

@@ -238,7 +238,7 @@ public class MyClass {
238238

239239
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.
240240

241-
### Logging
241+
### Custom logging
242242

243243
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.
244244

@@ -259,6 +259,29 @@ public class Function {
259259
}
260260
```
261261

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+
262285
## Environment variables
263286

264287
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.

0 commit comments

Comments
 (0)