Tutorial: Observability of managed Java components in Azure Container Apps

Java components include built-in observability features that can give you a holistic view of Java component health throughout its lifecycle. In this tutorial, you learn how to query logs messages generated by a Java component.

Prerequisites

The following prerequisites are required for this tutorial.

Resource Description
Azure Log Analytics To use the built-in observability features of managed Java components, ensure you set up Azure Log Analytics to use Log Analytics or Azure Monitor.
Java component Make sure to create at least one Java component in your environment, such as Config Server.

Query log data

Log Analytics is a tool that helps you view and analyze log data. Using Log Analytics, you can write Kusto queries to retrieve, sort, filter, and visualize log data. These visualizations help you spot trends and identify issues with your application. You can work interactively with the query results or use them with other features such as alerts, dashboards, and workbooks.

  1. Open the Azure portal and go to your Azure Log Analytics workspace.

  2. Select Logs from the sidebar.

  3. In the query tab, under the Tables section, under Custom Logs, select the ContainerAppSystemlogs_CL table.

You query the component logs via the Azure CLI log analytics extension.

  1. Run the following command to create a variable for your Log Analytics workspace ID.

    Make sure to replace <WORKSPACE_ID> with your Log Analytics workspace ID before running the query.

    SET $WORKSPACE_ID=<WORKSPACE_ID>
    

Query Java Component Log with Azure monitor

You can query Azure Monitor for monitoring data for your Java component logs.

  1. Open the Azure portal and go to your Container Apps environment.

  2. From the sidebar, under the Monitoring section, select Logs.

  3. In the query tab, in the Tables section, under the Container Apps heading, select the ContainerAppSystemLogs table.

You query the component logs via the Azure CLI log analytics extension.

  1. Run the following command to create a variable for your Log Analytics workspace ID.

    Make sure to replace <WORKSPACE_ID> with your Log Analytics workspace ID before running the query.

    SET $WORKSPACE_ID=<WORKSPACE_ID>