Logger Class

  • java.lang.Object
    • com.microsoft.aad.adal.Logger

public class Logger

Android log output can. If externalLogger is set, it will use that as well. Usage: Logger.v(tag, message, additionalMessage, errorCode) to log. Set custom logger: Logger.setExternalLogger(..);

Method Summary

Modifier and Type Method and Description
void d(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> instead. </p>

</xrefdescription>

Logs debug message.

void e(String tag, String message)

Logs error message.

void e(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

void e(String tag, String message, String additionalMessage, ADALError errorCode, Throwable throwable)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

void e(String tag, String message, Throwable throwable)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

String getCorrelationId()
Logger getInstance()
void i(String tag, String message, String additionalMessage)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#infoPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs informational message.

void i(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#infoPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs informational messages with error codes.

void setAndroidLogEnabled(final boolean androidLogEnabled)

Enable/Disable the Android logcat logging. By default, the sdk disables it.

void setCorrelationId(UUID correlation)

Sets the correlation id for the logger.

void setEnablePII(final boolean enablePII)

ADAL provides logging callbacks that assist in diagnostics. The callback has two parameters, message and additionalMessage. All user information is put into additionalMessage. ADAL will clear this data unless the com.microsoft.identity.common.internal.logging.Logger#mAllowPii is called with true. By default the library will not return any messages with user information in them.

synchronized void setExternalLogger(ILogger externalLogger)

Set the custom logger. Configures external logging to configure a callback that the sdk will use to pass each log message. Overriding the logger callback is not allowed.

void setLogLevel(final LogLevel logLevel)

Set the log level for diagnostic purpose. By default, the sdk enables the verbose level logging.

void v(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbose(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbosePII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs verbose message.

void v(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbose(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbosePII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs verbose message with error code.

void w(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs warning message.

void w(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs warning message.

Method Details

d

public static void d(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> instead. </p>

</xrefdescription>

Logs debug message.

Parameters:

tag - tag for the log message
message - body of the log message

e

public static void e(String tag, String message)

Logs error message.

Parameters:

tag - Tag for the log
message - Message to add to the log

e

public static void e(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

Parameters:

tag - tag for the log message
message - body of the log message
additionalMessage - additional parameters
errorCode - ADAL error code being logged

e

public static void e(String tag, String message, String additionalMessage, ADALError errorCode, Throwable throwable)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

Parameters:

tag - Tag for the log
message - Message to add to the log
additionalMessage - any additional parameters
errorCode - ADAL error code
throwable - Throwable

e

public static void e(String tag, String message, Throwable throwable)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs error message.

Parameters:

tag - Tag for the log
message - Message to add to the log
throwable - Throwable

getCorrelationId

public String getCorrelationId()

Returns:

the correlation id for the logger.

getInstance

public static Logger getInstance()

Returns:

The single instance of Logger.

i

public static void i(String tag, String message, String additionalMessage)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#infoPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs informational message.

Parameters:

tag - tag for the log message
message - body of the log message
additionalMessage - additional parameters

i

public static void i(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#info(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#infoPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs informational messages with error codes.

Parameters:

tag - tag for the log message
message - body of the log message
additionalMessage - additional parameters
errorCode - ADAL error code being logged

setAndroidLogEnabled

public void setAndroidLogEnabled(final boolean androidLogEnabled)

Enable/Disable the Android logcat logging. By default, the sdk disables it.

Parameters:

androidLogEnabled - True if enabling the logcat logging, false otherwise.

setCorrelationId

public static void setCorrelationId(UUID correlation)

Sets the correlation id for the logger.

Parameters:

correlation - Correlation ID to be used

setEnablePII

public void setEnablePII(final boolean enablePII)

ADAL provides logging callbacks that assist in diagnostics. The callback has two parameters, message and additionalMessage. All user information is put into additionalMessage. ADAL will clear this data unless the com.microsoft.identity.common.internal.logging.Logger#mAllowPii is called with true. By default the library will not return any messages with user information in them.

Parameters:

enablePII - True if enabling PII info to be logged, false otherwise.

setExternalLogger

public synchronized void setExternalLogger(ILogger externalLogger)

Set the custom logger. Configures external logging to configure a callback that the sdk will use to pass each log message. Overriding the logger callback is not allowed.

Parameters:

externalLogger - The reference to the Logger.ILogger that can output the logs to the designated places.

setLogLevel

public void setLogLevel(final LogLevel logLevel)

Set the log level for diagnostic purpose. By default, the sdk enables the verbose level logging.

Parameters:

logLevel - The Logger.LogLevel to be enabled for the diagnostic logging.

v

public static void v(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbose(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbosePII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs verbose message.

Parameters:

tag - tag for the log message
message - body of the log message

v

public static void v(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbose(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#verbosePII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs verbose message with error code.

Parameters:

tag - tag for the log message
message - body of the log message
additionalMessage - additional parameters
errorCode - ADAL error code being logged

w

public static void w(String tag, String message)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs warning message.

Parameters:

tag - tag for the log message
message - body of the log message

w

public static void w(String tag, String message, String additionalMessage, ADALError errorCode)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String)"></xref> if the log message does not contain any PII information. use <xref uid="" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String)"></xref> if the log message contains any PII information. </p>

</xrefdescription>

Logs warning message.

Parameters:

tag - tag for the log message
message - body of the log message
additionalMessage - additional parameters
errorCode - ADAL error code being logged

Applies to