////
    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=log4j.configuration.clock]
== `log4j.configuration.clock`

[cols="1h,5"]
|===
| Env. variable | `LOG4J_CONFIGURATION_CLOCK`
| Type          | link:../javadoc/log4j-core/org/apache/logging/log4j/core/util/Clock.html[`Class<? extends Clock>`] or predefined constant
| Default value | ``SystemClock``
|===

Specifies the
link:../javadoc/log4j-core/org/apache/logging/log4j/core/time/Clock.html[`Clock`]
implementation used to timestamp log events.

This must be the fully qualified class name of the implementation or one of these predefined constants:

SystemClock:: uses the best available system clock as time source.
See https://docs.oracle.com/en/java/javase/{java-target-version}/docs/api/java.base/java/time/Clock.html#systemDefaultZone()[`Clock.systemDefaultZone()`] for details.

SystemMillisClock:: same as `SystemClock`, but truncates the result to a millisecond.

CachedClock:: uses a separate thread to update the timestamp value.
See
link:../javadoc/log4j-core/org/apache/logging/log4j/core/util/CachedClock.html[`CachedClock`]
for details.

CoarseCachedClock:: alternative implementation of `CachedClock` with a slightly lower precision.
See
link:../javadoc/log4j-core/org/apache/logging/log4j/core/time/internal/CoarseCachedClock.html[JavaDoc]
for details.

[id=log4j.configuration.usePreciseClock]
== `log4j.configuration.usePreciseClock`

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

If set to `true` the `SystemClock` will use the best precision provided by the system.
Otherwise, it will truncate the timestamp up to the milliseconds.

See also <<log4j.configuration.clock>>.

[id=log4j.loader.ignoreTccl]
== `log4j.loader.ignoreTccl`

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

If `true`, classes are only loaded using the same classloader that loaded Log4j.

Otherwise, an attempt is made to load classes with the current thread's context class loader before falling back to the default class loader.

[id=log4j.configuration.reliabilityStrategy]
== `log4j.configuration.reliabilityStrategy`

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

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

| Default value
| `AwaitCompletion`
|===

Specifies the
link:../javadoc/log4j-core/org/apache/logging/log4j/core/config/ReliabilityStrategy.html[`ReliabilityStrategy`]
to adopt in order to prevent loss of log events during a reconfiguration.

The value must be the fully qualified class name of a `ReliabilityStrategy` implementation or one of these predefined constants:

AwaitCompletion::
Counts the number of threads that have started to log an event but have not completed yet and waits for these threads to finish before stopping the appenders.

AwaitUnconditionally::
Waits for a configured amount of time before stopping the appenders.
See <<log4j.configuration.waitMillisBeforeStopOldConfig>>.

Locking::
Uses read/write locks to prevent appenders from stopping while some threads are still logging events.

[id=log4j.configuration.waitMillisBeforeStopOldConfig]
== `log4j.configuration.waitMillisBeforeStopOldConfig`

[cols="1h,5"]
|===
| Env. variable | `LOG4J_CONFIGURATION_WAIT_MILLIS_BEFORE_STOP_OLD_CONFIG`
| Type          | `long`
| Default value | `5000`
|===

Number of milliseconds to wait before stopping the old configuration if the `AwaitUnconditionally` reliability strategy is used.
See <<log4j.configuration.reliabilityStrategy>>.

[id=log4j.uuid.sequence]
== `log4j.uuid.sequence`

[cols="1h,5"]
|===
| Env. variable | `LOG4J_UUID_SEQUENCE`
| Type          | `long`
| Default value | `0`
|===

Provides a `long` see to the UUID generator used by the `%uuid` pattern converter.

Can be used to assure uniqueness of UUIDs generated by multiple JVMs on the same machine.
