azure-docs-sdk-java/docs-ref-autogen/com.azure.core.util.logging...

352 строки
36 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.util.logging.ClientLogger"
fullName: "com.azure.core.util.logging.ClientLogger"
name: "ClientLogger"
nameWithType: "ClientLogger"
summary: "This is a fluent logger helper class that wraps a pluggable <xref uid=\"org.slf4j.Logger\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Logger\"></xref>."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public class **ClientLogger**"
constructors:
- uid: "com.azure.core.util.logging.ClientLogger.ClientLogger(java.lang.Class<?>)"
fullName: "com.azure.core.util.logging.ClientLogger.ClientLogger(Class<?> clazz)"
name: "ClientLogger(Class<?> clazz)"
nameWithType: "ClientLogger.ClientLogger(Class<?> clazz)"
summary: "Retrieves a logger for the passed class using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
parameters:
- description: "Class creating the logger."
name: "clazz"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a>&lt;?&gt;"
syntax: "public ClientLogger(Class<?> clazz)"
desc: "Retrieves a logger for the passed class using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
- uid: "com.azure.core.util.logging.ClientLogger.ClientLogger(java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Object>)"
fullName: "com.azure.core.util.logging.ClientLogger.ClientLogger(Class<?> clazz, Map<String,Object> context)"
name: "ClientLogger(Class<?> clazz, Map<String,Object> context)"
nameWithType: "ClientLogger.ClientLogger(Class<?> clazz, Map<String,Object> context)"
summary: "Retrieves a logger for the passed class using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
parameters:
- description: "Class creating the logger."
name: "clazz"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a>&lt;?&gt;"
- description: "Context to be populated on every log record written with this logger. Objects are serialized with\n <code>toString()</code> method."
name: "context"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Map.html\">Map</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
syntax: "public ClientLogger(Class<?> clazz, Map<String,Object> context)"
desc: "Retrieves a logger for the passed class using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
- uid: "com.azure.core.util.logging.ClientLogger.ClientLogger(java.lang.String)"
fullName: "com.azure.core.util.logging.ClientLogger.ClientLogger(String className)"
name: "ClientLogger(String className)"
nameWithType: "ClientLogger.ClientLogger(String className)"
summary: "Retrieves a logger for the passed class name using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
parameters:
- description: "Class name creating the logger."
name: "className"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public ClientLogger(String className)"
desc: "Retrieves a logger for the passed class name using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref>."
- uid: "com.azure.core.util.logging.ClientLogger.ClientLogger(java.lang.String,java.util.Map<java.lang.String,java.lang.Object>)"
fullName: "com.azure.core.util.logging.ClientLogger.ClientLogger(String className, Map<String,Object> context)"
name: "ClientLogger(String className, Map<String,Object> context)"
nameWithType: "ClientLogger.ClientLogger(String className, Map<String,Object> context)"
summary: "Retrieves a logger for the passed class name using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref> with context that will be populated on all log records produced with this logger."
parameters:
- description: "Class name creating the logger."
name: "className"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Context to be populated on every log record written with this logger. Objects are serialized with\n <code>toString()</code> method."
name: "context"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Map.html\">Map</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
syntax: "public ClientLogger(String className, Map<String,Object> context)"
desc: "Retrieves a logger for the passed class name using the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggerFactory\"></xref> with context that will be populated on all log records produced with this logger.\n\n```java\nMap<String, Object> context = new HashMap<>();\n context.put(\"connectionId\", \"95a47cf\");\n\n ClientLogger loggerWithContext = new ClientLogger(ClientLoggerJavaDocCodeSnippets.class, context);\n loggerWithContext.info(\"A formattable message. Hello, {}\", name);\n```"
methods:
- uid: "com.azure.core.util.logging.ClientLogger.<T>logThowableAsWarning(T)"
fullName: "com.azure.core.util.logging.ClientLogger.logThowableAsWarning(T throwable)"
name: "logThowableAsWarning(T throwable)"
nameWithType: "ClientLogger.logThowableAsWarning(T throwable)"
summary: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the warning level and returns it to be thrown."
deprecatedTag: "Use <xref uid=\"com.azure.core.util.logging.ClientLogger.logThrowableAsWarning*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logThrowableAsWarning(Throwable)\"></xref> instead."
parameters:
- description: "Throwable to be logged and returned."
name: "throwable"
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public T <T>logThowableAsWarning(T throwable)"
desc: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the warning level and returns it to be thrown.\n\nThis API covers the cases where a checked exception type needs to be thrown and logged. If a <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> is being logged use <xref uid=\"com.azure.core.util.logging.ClientLogger.logExceptionAsWarning(java.lang.RuntimeException)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logExceptionAsWarning(RuntimeException)\"></xref> instead."
hasDeprecatedTag: true
returns:
description: "The passed <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.<T>logThrowableAsError(T)"
fullName: "com.azure.core.util.logging.ClientLogger.logThrowableAsError(T throwable)"
name: "logThrowableAsError(T throwable)"
nameWithType: "ClientLogger.logThrowableAsError(T throwable)"
summary: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the error level and returns it to be thrown."
parameters:
- description: "Throwable to be logged and returned."
name: "throwable"
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
syntax: "public T <T>logThrowableAsError(T throwable)"
desc: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the error level and returns it to be thrown.\n\nThis API covers the cases where a checked exception type needs to be thrown and logged. If a <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> is being logged use <xref uid=\"com.azure.core.util.logging.ClientLogger.logExceptionAsError(java.lang.RuntimeException)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logExceptionAsError(RuntimeException)\"></xref> instead."
returns:
description: "The passed <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.<T>logThrowableAsWarning(T)"
fullName: "com.azure.core.util.logging.ClientLogger.logThrowableAsWarning(T throwable)"
name: "logThrowableAsWarning(T throwable)"
nameWithType: "ClientLogger.logThrowableAsWarning(T throwable)"
summary: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the warning level and returns it to be thrown."
parameters:
- description: "Throwable to be logged and returned."
name: "throwable"
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
syntax: "public T <T>logThrowableAsWarning(T throwable)"
desc: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> at the warning level and returns it to be thrown.\n\nThis API covers the cases where a checked exception type needs to be thrown and logged. If a <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> is being logged use <xref uid=\"com.azure.core.util.logging.ClientLogger.logExceptionAsWarning(java.lang.RuntimeException)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logExceptionAsWarning(RuntimeException)\"></xref> instead."
returns:
description: "The passed <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.atError()"
fullName: "com.azure.core.util.logging.ClientLogger.atError()"
name: "atError()"
nameWithType: "ClientLogger.atError()"
summary: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `error` log level that can be used to enrich log with additional context."
syntax: "public LoggingEventBuilder atError()"
desc: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `error` log level that can be used to enrich log with additional context.\n\n**Code samples**\n\nLogging with context at error level.\n\n```java\nlogger.atVerbose()\n .addKeyValue(\"key\", 1L)\n .log(() -> String.format(\"Param 1: %s, Param 2: %s, Param 3: %s\", \"param1\", \"param2\", \"param3\"));\n```"
returns:
description: "instance of <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> or no-op if error logging is disabled."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.atInfo()"
fullName: "com.azure.core.util.logging.ClientLogger.atInfo()"
name: "atInfo()"
nameWithType: "ClientLogger.atInfo()"
summary: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `info` log level that can be used to enrich log with additional context."
syntax: "public LoggingEventBuilder atInfo()"
desc: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `info` log level that can be used to enrich log with additional context.\n\n**Code samples**\n\nLogging with context at info level.\n\n```java\nlogger.atInfo()\n .addKeyValue(\"key\", \"value\")\n .log(\"A formattable message. Hello, {}\", name);\n```"
returns:
description: "instance of <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> or no-op if info logging is disabled."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.atLevel(com.azure.core.util.logging.LogLevel)"
fullName: "com.azure.core.util.logging.ClientLogger.atLevel(LogLevel level)"
name: "atLevel(LogLevel level)"
nameWithType: "ClientLogger.atLevel(LogLevel level)"
summary: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for log level that can be used to enrich log with additional context."
parameters:
- description: "log level."
name: "level"
type: "<xref href=\"com.azure.core.util.logging.LogLevel?alt=com.azure.core.util.logging.LogLevel&text=LogLevel\" data-throw-if-not-resolved=\"False\" />"
syntax: "public LoggingEventBuilder atLevel(LogLevel level)"
desc: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for log level that can be used to enrich log with additional context.\n\n**Code samples**\n\nLogging with context at provided level.\n\n```java\nLogLevel level = response.getStatusCode() == 200 ? LogLevel.INFORMATIONAL : LogLevel.WARNING;\n logger.atLevel(level)\n .addKeyValue(\"key\", \"value\")\n .log(\"message\");\n```"
returns:
description: "instance of <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> or no-op if logging at provided level is disabled."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.atVerbose()"
fullName: "com.azure.core.util.logging.ClientLogger.atVerbose()"
name: "atVerbose()"
nameWithType: "ClientLogger.atVerbose()"
summary: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `verbose` log level that can be used to enrich log with additional context."
syntax: "public LoggingEventBuilder atVerbose()"
desc: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `verbose` log level that can be used to enrich log with additional context.\n\n**Code samples**\n\nLogging with context at verbose level.\n\n```java\nlogger.atVerbose()\n .addKeyValue(\"key\", 1L)\n .log(() -> String.format(\"Param 1: %s, Param 2: %s, Param 3: %s\", \"param1\", \"param2\", \"param3\"));\n```"
returns:
description: "instance of <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> or no-op if verbose logging is disabled."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.atWarning()"
fullName: "com.azure.core.util.logging.ClientLogger.atWarning()"
name: "atWarning()"
nameWithType: "ClientLogger.atWarning()"
summary: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `warning` log level that can be used to enrich log with additional context."
syntax: "public LoggingEventBuilder atWarning()"
desc: "Creates <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> for `warning` log level that can be used to enrich log with additional context.\n\n**Code samples**\n\nLogging with context at warning level.\n\n```java\nlogger.atWarning()\n .addKeyValue(\"key\", \"value\")\n .log(\"A formattable message. Hello, {}\", name, exception);\n```"
returns:
description: "instance of <xref uid=\"com.azure.core.util.logging.LoggingEventBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LoggingEventBuilder\"></xref> or no-op if warn logging is disabled."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.canLogAtLevel(com.azure.core.util.logging.LogLevel)"
fullName: "com.azure.core.util.logging.ClientLogger.canLogAtLevel(LogLevel logLevel)"
name: "canLogAtLevel(LogLevel logLevel)"
nameWithType: "ClientLogger.canLogAtLevel(LogLevel logLevel)"
summary: "Determines if the app or environment logger support logging at the given log level."
parameters:
- description: "Logging level for the log message."
name: "logLevel"
type: "<xref href=\"com.azure.core.util.logging.LogLevel?alt=com.azure.core.util.logging.LogLevel&text=LogLevel\" data-throw-if-not-resolved=\"False\" />"
syntax: "public boolean canLogAtLevel(LogLevel logLevel)"
desc: "Determines if the app or environment logger support logging at the given log level."
returns:
description: "Flag indicating if the environment and logger are configured to support logging at the given log level."
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.ClientLogger.error(java.lang.String)"
fullName: "com.azure.core.util.logging.ClientLogger.error(String message)"
name: "error(String message)"
nameWithType: "ClientLogger.error(String message)"
summary: "Logs a message at `error` log level."
parameters:
- description: "The message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void error(String message)"
desc: "Logs a message at `error` log level.\n\n**Code samples**\n\nLogging a message at error log level.\n\n```java\ntry {\n upload(resource);\n } catch (IOException ex) {\n logger.error(ex.getMessage());\n }\n```"
- uid: "com.azure.core.util.logging.ClientLogger.error(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.ClientLogger.error(String format, Object[] args)"
name: "error(String format, Object[] args)"
nameWithType: "ClientLogger.error(String format, Object[] args)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `error` log level."
parameters:
- description: "The format-able message to log."
name: "format"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the\n <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "args"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>[]"
syntax: "public void error(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `error` log level.\n\n**Code samples**\n\nLogging an error with stack trace.\n\n```java\ntry {\n upload(resource);\n } catch (IOException ex) {\n logger.error(\"A formattable message. Hello, {}\", name, ex);\n }\n```"
- uid: "com.azure.core.util.logging.ClientLogger.info(java.lang.String)"
fullName: "com.azure.core.util.logging.ClientLogger.info(String message)"
name: "info(String message)"
nameWithType: "ClientLogger.info(String message)"
summary: "Logs a message at `info` log level."
parameters:
- description: "The message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void info(String message)"
desc: "Logs a message at `info` log level.\n\n**Code samples**\n\nLogging a message at verbose log level.\n\n```java\nlogger.info(\"A log message\");\n```"
- uid: "com.azure.core.util.logging.ClientLogger.info(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.ClientLogger.info(String format, Object[] args)"
name: "info(String format, Object[] args)"
nameWithType: "ClientLogger.info(String format, Object[] args)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `informational` log level."
parameters:
- description: "The format-able message to log"
name: "format"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the\n <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "args"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>[]"
syntax: "public void info(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `informational` log level.\n\n**Code samples**\n\nLogging a message at informational log level.\n\n```java\nlogger.info(\"A formattable message. Hello, {}\", name);\n```"
- uid: "com.azure.core.util.logging.ClientLogger.log(com.azure.core.util.logging.LogLevel,java.util.function.Supplier<java.lang.String>)"
fullName: "com.azure.core.util.logging.ClientLogger.log(LogLevel logLevel, Supplier<String> message)"
name: "log(LogLevel logLevel, Supplier<String> message)"
nameWithType: "ClientLogger.log(LogLevel logLevel, Supplier<String> message)"
summary: "Logs a format-able message that uses `{}` as the placeholder at the given `logLevel`."
parameters:
- description: "Logging level for the log message."
name: "logLevel"
type: "<xref href=\"com.azure.core.util.logging.LogLevel?alt=com.azure.core.util.logging.LogLevel&text=LogLevel\" data-throw-if-not-resolved=\"False\" />"
- description: "The format-able message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html\">Supplier</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "public void log(LogLevel logLevel, Supplier<String> message)"
desc: "Logs a format-able message that uses `{}` as the placeholder at the given `logLevel`.\n\n**Code samples**\n\nLogging with a specific log level\n\n```java\nlogger.log(LogLevel.VERBOSE,\n () -> String.format(\"Param 1: %s, Param 2: %s, Param 3: %s\", \"param1\", \"param2\", \"param3\"));\n```"
- uid: "com.azure.core.util.logging.ClientLogger.log(com.azure.core.util.logging.LogLevel,java.util.function.Supplier<java.lang.String>,java.lang.Throwable)"
fullName: "com.azure.core.util.logging.ClientLogger.log(LogLevel logLevel, Supplier<String> message, Throwable throwable)"
name: "log(LogLevel logLevel, Supplier<String> message, Throwable throwable)"
nameWithType: "ClientLogger.log(LogLevel logLevel, Supplier<String> message, Throwable throwable)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `verbose` log level."
parameters:
- description: "Logging level for the log message."
name: "logLevel"
type: "<xref href=\"com.azure.core.util.logging.LogLevel?alt=com.azure.core.util.logging.LogLevel&text=LogLevel\" data-throw-if-not-resolved=\"False\" />"
- description: "The format-able message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html\">Supplier</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
- description: "Throwable for the message. <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "throwable"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html\">Throwable</a>"
syntax: "public void log(LogLevel logLevel, Supplier<String> message, Throwable throwable)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `verbose` log level.\n\n**Code samples**\n\nLogging with a specific log level and exception\n\n```java\nThrowable illegalArgumentException = new IllegalArgumentException(\"An invalid argument was encountered.\");\n logger.log(LogLevel.VERBOSE,\n () -> String.format(\"Param 1: %s, Param 2: %s, Param 3: %s\", \"param1\", \"param2\", \"param3\"),\n illegalArgumentException);\n```"
- uid: "com.azure.core.util.logging.ClientLogger.logExceptionAsError(java.lang.RuntimeException)"
fullName: "com.azure.core.util.logging.ClientLogger.logExceptionAsError(RuntimeException runtimeException)"
name: "logExceptionAsError(RuntimeException runtimeException)"
nameWithType: "ClientLogger.logExceptionAsError(RuntimeException runtimeException)"
summary: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> at the error level and returns it to be thrown."
parameters:
- description: "RuntimeException to be logged and returned."
name: "runtimeException"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
syntax: "public RuntimeException logExceptionAsError(RuntimeException runtimeException)"
desc: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> at the error level and returns it to be thrown.\n\nThis API covers the cases where a runtime exception type needs to be thrown and logged. If a <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> is being logged use <xref uid=\"com.azure.core.util.logging.ClientLogger.logThrowableAsError*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logThrowableAsError(Throwable)\"></xref> instead."
returns:
description: "The passed <code>RuntimeException</code>."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
- uid: "com.azure.core.util.logging.ClientLogger.logExceptionAsWarning(java.lang.RuntimeException)"
fullName: "com.azure.core.util.logging.ClientLogger.logExceptionAsWarning(RuntimeException runtimeException)"
name: "logExceptionAsWarning(RuntimeException runtimeException)"
nameWithType: "ClientLogger.logExceptionAsWarning(RuntimeException runtimeException)"
summary: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> at the warning level and returns it to be thrown."
parameters:
- description: "RuntimeException to be logged and returned."
name: "runtimeException"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
syntax: "public RuntimeException logExceptionAsWarning(RuntimeException runtimeException)"
desc: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> at the warning level and returns it to be thrown.\n\nThis API covers the cases where a runtime exception type needs to be thrown and logged. If a <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> is being logged use <xref uid=\"com.azure.core.util.logging.ClientLogger.logThrowableAsWarning*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#logThrowableAsWarning(Throwable)\"></xref> instead."
returns:
description: "The passed <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref>."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
- uid: "com.azure.core.util.logging.ClientLogger.verbose(java.lang.String)"
fullName: "com.azure.core.util.logging.ClientLogger.verbose(String message)"
name: "verbose(String message)"
nameWithType: "ClientLogger.verbose(String message)"
summary: "Logs a message at `verbose` log level."
parameters:
- description: "The message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void verbose(String message)"
desc: "Logs a message at `verbose` log level.\n\n**Code samples**\n\nLogging a message at verbose log level.\n\n```java\nlogger.verbose(\"A log message\");\n```"
- uid: "com.azure.core.util.logging.ClientLogger.verbose(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.ClientLogger.verbose(String format, Object[] args)"
name: "verbose(String format, Object[] args)"
nameWithType: "ClientLogger.verbose(String format, Object[] args)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `verbose` log level."
parameters:
- description: "The formattable message to log."
name: "format"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the\n <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "args"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>[]"
syntax: "public void verbose(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `verbose` log level.\n\n**Code samples**\n\nLogging a message at verbose log level.\n\n```java\nlogger.verbose(\"A formattable message. Hello, {}\", name);\n```"
- uid: "com.azure.core.util.logging.ClientLogger.warning(java.lang.String)"
fullName: "com.azure.core.util.logging.ClientLogger.warning(String message)"
name: "warning(String message)"
nameWithType: "ClientLogger.warning(String message)"
summary: "Logs a message at `warning` log level."
parameters:
- description: "The message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void warning(String message)"
desc: "Logs a message at `warning` log level.\n\n**Code samples**\n\nLogging a message at warning log level.\n\n```java\nThrowable detailedException = new IllegalArgumentException(\"A exception with a detailed message\");\n logger.warning(detailedException.getMessage());\n```"
- uid: "com.azure.core.util.logging.ClientLogger.warning(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.ClientLogger.warning(String format, Object[] args)"
name: "warning(String format, Object[] args)"
nameWithType: "ClientLogger.warning(String format, Object[] args)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `warning` log level."
parameters:
- description: "The format-able message to log."
name: "format"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the\n <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "args"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>[]"
syntax: "public void warning(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `warning` log level.\n\n**Code samples**\n\nLogging a message at warning log level.\n\n```java\nThrowable exception = new IllegalArgumentException(\"An invalid argument was encountered.\");\n logger.warning(\"A formattable message. Hello, {}\", name, exception);\n```"
type: "class"
desc: "This is a fluent logger helper class that wraps a pluggable <xref uid=\"org.slf4j.Logger\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Logger\"></xref>.\n\nThis logger logs format-able messages that use `{}` as the placeholder. When a <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"throwable\"></xref> is the last argument of the format varargs and the logger is enabled for <xref uid=\"ClientLogger#verbose(String,\n Object...)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"verbose\"></xref>, the stack trace for the throwable is logged.\n\nA minimum logging level threshold is determined by the <xref uid=\"com.azure.core.util.Configuration.PROPERTY_AZURE_LOG_LEVEL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AZURE_LOG_LEVEL\"></xref> environment configuration. By default logging is **disabled**.\n\n**Log level hierarchy**\n\n1. <xref uid=\"com.azure.core.util.logging.ClientLogger.error*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Error\"></xref>\n2. <xref uid=\"com.azure.core.util.logging.ClientLogger.warning*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Warning\"></xref>\n3. <xref uid=\"com.azure.core.util.logging.ClientLogger.info*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Info\"></xref>\n4. <xref uid=\"com.azure.core.util.logging.ClientLogger.verbose*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Verbose\"></xref>\n\nThe logger is capable of producing json-formatted messages enriched with key value pairs. Context can be provided in the constructor and populated on every message or added per each log record."
metadata: {}
package: "com.azure.core.util.logging"
artifact: com.azure:azure-core:1.52.0