////
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
////
[id=log4j2.formatMsgAsync]
== `log4j2.formatMsgAsync`

[cols="1h,5"]
|===
| Env. variable | `LOG4J_FORMAT_MSG_ASYNC`
| Type          | `boolean`
| Default value | `false`
|===

If `false`, Log4j will make sure the message is formatted in the caller thread, otherwise the formatting will occur on the asynchronous thread.

**Remark**: messages annotated with
link:../javadoc/log4j-api/org/apache/logging/log4j/message/AsynchronouslyFormattable.html[`AsynchronouslyFormattable`]
will be formatted on the async thread regardless of this setting.

[id=log4j2.asyncQueueFullPolicy]
== `log4j2.asyncQueueFullPolicy`

[cols="1h,5"]
|===
| Env. variable
| `LOG4J_ASYNC_QUEUE_FULL_POLICY`

| Type
| link:../javadoc/log4j-core/org/apache/logging/log4j/core/async/AsyncQueueFullPolicy.html[`Class<? extends AsyncQueueFullPolicy>`]
or predefined constant

| Default value
| `Default`
|===

Determines the
link:../javadoc/log4j-core/org/apache/logging/log4j/core/async/AsyncQueueFullPolicy.html[`AsyncQueueFullPolicy`]
to use when the underlying async component cannot keep up with the logging rate and the queue is filling up.

Its value should be the fully qualified class name of an `AsyncQueueFullPolicy` implementation or one of these predefined constants:

Default:: blocks the calling thread until the event can be added to the queue.

Discard:: when the queue is full, it drops the events whose level is equal or less than the threshold level (see
<<log4j2.discardThreshold>>).

[id=log4j2.discardThreshold]
== `log4j2.discardThreshold`

[cols="1h,5"]
|===
| Env. variable | `LOG4J_DISCARD_THRESHOLD`
| Type          | link:../javadoc/log4j-api/org/apache/logging/log4j/Level.html[`Level`]
| Default value | `INFO`
|===

Determines the threshold level used by a `Discard` queue full policy.
Log events whose level is not more severe than the threshold level will be discarded during a queue full event.
See also <<log4j2.asyncQueueFullPolicy>>.
