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
MSAL for Java allows you to use the logging library that you are already using with your app, as long as it is compatible with SLF4J. MSAL for Java uses the [Simple Logging Facade for Java](http://www.slf4j.org/) (SLF4J) as a simple facade or abstraction for various logging frameworks, such as [java.util.logging](https://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html), [Logback](http://logback.qos.ch/) and [Log4j](https://logging.apache.org/log4j/2.x/). SLF4J allows the user to plug in the desired logging framework at deployment time.
24
-
25
-
For example, to use Logback as the logging framework in your application, add the Logback dependency to the Maven pom file for your application:
26
-
27
-
```xml
28
-
<dependency>
29
-
<groupId>ch.qos.logback</groupId>
30
-
<artifactId>logback-classic</artifactId>
31
-
<version>1.2.3</version>
32
-
</dependency>
33
-
```
34
-
35
-
Then add the Logback configuration file:
36
-
37
-
```xml
38
-
<?xml version="1.0" encoding="UTF-8"?>
39
-
<configurationdebug="true">
40
-
41
-
</configuration>
42
-
```
43
-
44
-
SLF4J automatically binds to Logback at deployment time. MSAL logs will be written to the console.
24
+
MSAL for Java allows you to use the logging library that you're already using with your app, as long as it's compatible with SLF4J. MSAL for Java uses the [Simple Logging Facade for Java](http://www.slf4j.org/) (SLF4J) as a simple facade or abstraction for various logging frameworks, such as [java.util.logging](https://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html), [Logback](http://logback.qos.ch/) and [Log4j](https://logging.apache.org/log4j/2.x/). SLF4J allows the user to plug in the desired logging framework at deployment time and automatically binds to Logback at deployment time. MSAL logs will be written to the console.
25
+
26
+
This article shows how to enable MSAL4J logging using the logback framework in a spring boot web application. You can refer to the [code sample](https://github.com/Azure-Samples/ms-identity-java-webapp/tree/master/msal-java-webapp-sample) for reference.
27
+
28
+
1. To implement logging, include the `logback` package in the *pom.xml* file.
29
+
30
+
```xml
31
+
<dependency>
32
+
<groupId>ch.qos.logback</groupId>
33
+
<artifactId>logback-classic</artifactId>
34
+
<version>1.2.3</version>
35
+
</dependency>
36
+
```
37
+
38
+
2. Navigate to the *resources* folder, and add a file called *logback.xml*, and insert the following code. This will append logs to the console. You can change the appender `class` to write logs to a file, database or any appender of your choosing.
3. Next, you should set the *logging.config* property to the location of the *logback.xml* file before the main method. Navigate to *MsalWebSampleApplication.java* and add the following code to the `MsalWebSampleApplication` public class.
In your tenant, you'll need separate app registrations for the web app and the web API. For app registration and exposing the web API scope, follow the steps in the scenario [A web app that authenticates users and calls web APIs](/scenario-web-app-call-api-overview).
45
71
46
72
For instructions on how to bind to other logging frameworks, see the [SLF4J manual](http://www.slf4j.org/manual.html).
47
73
48
74
### Personal and organization information
49
75
50
-
By default, MSAL logging does not capture or log any personal or organizational data. In the following example, logging personal or organizational data is off by default:
76
+
By default, MSAL logging doesn't capture or log any personal or organizational data. In the following example, logging personal or organizational data is off by default:
0 commit comments