### YamlMime:JavaType
uid: "com.azure.core.util.logging.LoggingEventBuilder"
fullName: "com.azure.core.util.logging.LoggingEventBuilder"
name: "LoggingEventBuilder"
nameWithType: "LoggingEventBuilder"
summary: "This class provides fluent API to write logs using and enrich them with additional context."
inheritances:
- ""
inheritedClassMethods:
- classRef: "java.lang.Object"
methodsRef:
- "clone"
- "equals"
- "finalize"
- "getClass"
- "hashCode"
- "notify"
- "notifyAll"
- "toString"
- "wait"
- "wait"
- "wait"
syntax: "public final class **LoggingEventBuilder**"
methods:
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,boolean)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, boolean value)"
name: "addKeyValue(String key, boolean value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, boolean value)"
summary: "Adds key with boolean value to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "String"
- description: "boolean value."
name: "value"
type: ""
syntax: "public LoggingEventBuilder addKeyValue(String key, boolean value)"
desc: "Adds key with boolean value to the context of current log being created."
returns:
description: "The updated LoggingEventBuilder
object."
type: ""
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.lang.Object)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, Object value)"
name: "addKeyValue(String key, Object value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, Object value)"
summary: "Adds key with Object value to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "String"
- description: "Object value."
name: "value"
type: "Object"
syntax: "public LoggingEventBuilder addKeyValue(String key, Object value)"
desc: "Adds key with Object value to the context of current log being created. If logging is enabled at given level, and object is not null, uses `value.toString()` to serialize object.\n\n**Code samples**\n\nAdding string value to logging event context.\n\n```java\nlogger.atVerbose()\n // equivalent to addKeyValue(\"key\", () -> new LoggableObject(\"string representation\").toString()\n .addKeyValue(\"key\", new LoggableObject(\"string representation\"))\n .log(\"Param 1: {}, Param 2: {}, Param 3: {}\", \"param1\", \"param2\", \"param3\");\n```"
returns:
description: "The updated LoggingEventBuilder
object."
type: ""
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.lang.String)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, String value)"
name: "addKeyValue(String key, String value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, String value)"
summary: "Adds key with String value pair to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "String"
- description: "String value."
name: "value"
type: "String"
syntax: "public LoggingEventBuilder addKeyValue(String key, String value)"
desc: "Adds key with String value pair to the context of current log being created.\n\n**Code samples**\n\nAdding string value to logging event context.\n\n```java\nlogger.atInfo()\n .addKeyValue(\"key\", \"value\")\n .log(\"A formattable message. Hello, {}\", name);\n```"
returns:
description: "The updated LoggingEventBuilder
object."
type: ""
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.util.function.Supplier)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, Supplier valueSupplier)"
name: "addKeyValue(String key, Supplier valueSupplier)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, Supplier valueSupplier)"
summary: "Adds key with String value supplier to the context of current log event being created."
parameters:
- description: "String key."
name: "key"
type: "String"
- description: "String value supplier function."
name: "valueSupplier"
type: "Supplier<String>"
syntax: "public LoggingEventBuilder addKeyValue(String key, Supplier valueSupplier)"
desc: "Adds key with String value supplier to the context of current log event being created."
returns:
description: "The updated LoggingEventBuilder
object."
type: ""
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,long)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, long value)"
name: "addKeyValue(String key, long value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, long value)"
summary: "Adds key with long value to the context of current log event being created."
parameters:
- description: "String key."
name: "key"
type: "String"
- description: "long value."
name: "value"
type: ""
syntax: "public LoggingEventBuilder addKeyValue(String key, long value)"
desc: "Adds key with long value to the context of current log event being created.\n\n**Code samples**\n\nAdding an integer value to logging event context.\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: "The updated LoggingEventBuilder
object."
type: ""
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.RuntimeException)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(RuntimeException runtimeException)"
name: "log(RuntimeException runtimeException)"
nameWithType: "LoggingEventBuilder.log(RuntimeException runtimeException)"
summary: "Logs the and returns it to be thrown."
parameters:
- description: "RuntimeException to be logged and returned."
name: "runtimeException"
type: "RuntimeException"
syntax: "public RuntimeException log(RuntimeException runtimeException)"
desc: "Logs the and returns it to be thrown. This API covers the cases where a checked exception type needs to be thrown and logged."
returns:
description: "The passed ."
type: "RuntimeException"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.String)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(String message)"
name: "log(String message)"
nameWithType: "LoggingEventBuilder.log(String message)"
summary: "Logs message annotated with context."
parameters:
- description: "the message to log."
name: "message"
type: "String"
syntax: "public void log(String message)"
desc: "Logs message annotated with context."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(String format, Object[] args)"
name: "log(String format, Object[] args)"
nameWithType: "LoggingEventBuilder.log(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: "String"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the ."
name: "args"
type: "Object[]"
syntax: "public void log(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `warning` log level."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.Throwable)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Throwable throwable)"
name: "log(Throwable throwable)"
nameWithType: "LoggingEventBuilder.log(Throwable throwable)"
summary: "Logs the and returns it to be thrown."
parameters:
- description: "Throwable to be logged and returned."
name: "throwable"
type: "Throwable"
syntax: "public Throwable log(Throwable throwable)"
desc: "Logs the and returns it to be thrown."
returns:
description: "The passed ."
type: "Throwable"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.util.function.Supplier)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Supplier messageSupplier)"
name: "log(Supplier messageSupplier)"
nameWithType: "LoggingEventBuilder.log(Supplier messageSupplier)"
summary: "Logs message annotated with context."
parameters:
- description: "string message supplier."
name: "messageSupplier"
type: "Supplier<String>"
syntax: "public void log(Supplier messageSupplier)"
desc: "Logs message annotated with context."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.util.function.Supplier,java.lang.Throwable)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Supplier messageSupplier, Throwable throwable)"
name: "log(Supplier messageSupplier, Throwable throwable)"
nameWithType: "LoggingEventBuilder.log(Supplier messageSupplier, Throwable throwable)"
summary: "Logs message annotated with context."
parameters:
- description: "string message supplier."
name: "messageSupplier"
type: "Supplier<String>"
- description: " for the message."
name: "throwable"
type: "Throwable"
syntax: "public void log(Supplier messageSupplier, Throwable throwable)"
desc: "Logs message annotated with context."
type: "class"
desc: "This class provides fluent API to write logs using and enrich them with additional context.\n\n**Code samples**\n\nLogging event with context.\n\n```java\nlogger.atInfo()\n .addKeyValue(\"key1\", \"value1\")\n .addKeyValue(\"key2\", true)\n .addKeyValue(\"key3\", () -> getName())\n .log(\"A formattable message. Hello, {}\", name);\n```"
metadata: {}
package: "com.azure.core.util.logging"
artifact: com.azure:azure-core:1.52.0