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
Copy file name to clipboardExpand all lines: support/entra/entra-id/app-integration/enable-msal4j-logging-spring-boot-webapp.md
+11-13Lines changed: 11 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Enable MSAL4J logging in a Spring Boot web application in Microsoft Entra ID
3
-
description: Describes how to enable MSAL4J logging in a Spring Boot web application in Microsoft Entra.
2
+
title: Enable MSAL4J Logging in a Spring Boot Web Application in Microsoft Entra ID
3
+
description: Discusses how to enable MSAL4J logging in a Spring Boot web application in Microsoft Entra.
4
4
ms.date: 03/10/2025
5
5
ms.author: bachoang
6
6
ms.service: entra-id
@@ -9,15 +9,15 @@ ms.custom: sap:Microsoft Entra App Integration and Development
9
9
10
10
# Enable MSAL4J logging in a Spring Boot web application
11
11
12
-
This article provides step-by-step instructions on how to enable [Microsoft Authentication Library for Java](https://github.com/AzureAD/microsoft-authentication-library-for-java) (MSAL4J) logging by using the [Logback framework](https://logback.qos.ch/) in a Spring Boot web application.
12
+
This article provides step-by-step instructions to enable [Microsoft Authentication Library for Java](https://github.com/AzureAD/microsoft-authentication-library-for-java) (MSAL4J) logging by using the [Logback framework](https://logback.qos.ch/) in a Spring Boot web application.
13
13
14
14
## Code sample
15
15
16
16
The complete code sample and configuration guide for this implementation are available on [GitHub](https://github.com/bachoang/MSAL4J_SpringBoot_Logging/tree/main/msal-b2c-web-sample).
17
17
18
18
## Enable MSAL4J logging
19
19
20
-
1. Add the following dependency to your pom.xml file to include the Logback framework:
20
+
1. Add the following dependency to your Pom.xml file to include the Logback framework:
21
21
22
22
```xml
23
23
<dependency>
@@ -27,7 +27,7 @@ The complete code sample and configuration guide for this implementation are ava
27
27
</dependency>
28
28
```
29
29
30
-
2. In your app project, create a new file named **logback.xml** in the **src/main/resources** folder and add the following content:
30
+
2. In your app project, create a file that's named **Logback.xml** in the **src/main/resources** folder, and then add the following content:
31
31
32
32
```xml
33
33
<?xml version="1.0" encoding="UTF-8"?>
@@ -43,8 +43,8 @@ The complete code sample and configuration guide for this implementation are ava
43
43
</configuration>
44
44
```
45
45
46
-
This Appender configuration logs messages to the console. You can adjust the logging level to `error`, `warn`, `info`, or `verbose` based on your preference. For more information, see [LogBack: Appenders](https://logback.qos.ch/manual/appenders.html)
47
-
3. Set the **logging.config** property to the location of the **logback.xml** file before the main method:
46
+
This Appender configuration logs messages to the console. You can adjust the logging level to `error`, `warn`, `info`, or `verbose` based on your preference. For more information, see [LogBack: Appenders](https://logback.qos.ch/manual/appenders.html).
47
+
3. Set the **logging.config** property to the location of the **Logback.xml** file before the main method:
48
48
49
49
```java
50
50
@SpringBootApplication
@@ -65,14 +65,14 @@ The complete code sample and configuration guide for this implementation are ava
65
65
66
66
### Enable HTTPs support
67
67
68
-
his code sample is set up to run on the local server (localhost) using the HTTPS protocol. Follow [Configure the sample to use your Azure AD B2C tenant](https://github.com/bachoang/MSAL4J_SpringBoot_Logging/tree/main/msal-b2c-web-sample#step-2--configure-the-sample-to-use-your-azure-ad-b2c-tenant) to generate a self-signed certificate and place the **keystore.p12** file in the resources folder.
68
+
This code sample is set up to run on the local server (localhost) by using the HTTPS protocol. Follow the steps in [Configure the sample to use your Azure AD B2C tenant](https://github.com/bachoang/MSAL4J_SpringBoot_Logging/tree/main/msal-b2c-web-sample#step-2--configure-the-sample-to-use-your-azure-ad-b2c-tenant) to generate a self-signed certificate. Put the **keystore.p12** file in the resources folder.
69
69
70
70
### App registration configuration
71
71
72
-
Follow these steps to configure app registration in Azure AD B2C:
72
+
To configure app registration in Azure AD B2C, follow these steps:
73
73
74
74
1. Create two app registrations in your Azure AD B2C tenant: One for the web application and the other for the web API.
75
-
2. Expose the required scope in the web API. Refer to [this documentation](/azure/active-directory-b2c/configure-authentication-sample-web-app-with-api?tabs=visual-studio#step-22-configure-web-api-app-scopes) for guidance on exposing web API scopes.
75
+
2. Expose the required scope in the web API. Refer to the guidance in ["Configure web API app scopes"](/azure/active-directory-b2c/configure-authentication-sample-web-app-with-api?tabs=visual-studio#step-22-configure-web-api-app-scopes) for more information.
76
76
3. Configure the web API scope in the **API Permissions** blade for the web application.
77
77
4. Grant admin consent to all configured permissions in the web application.
78
78
@@ -84,8 +84,6 @@ Example configuration:
84
84
85
85
## Logging output example
86
86
87
-
When the app is configured correctly, the logging output should resemble the following:
88
-
87
+
If the app is configured correctly, the logging output should resemble the following:
89
88
90
89
:::image type="content" source="media/enable-msal4j-logging-spring-boot-webapp/log-sample.png" alt-text="Diagram that shows logging output." border="true" lightbox="media/enable-msal4j-logging-spring-boot-webapp/log-sample.png":::
0 commit comments