// 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.
= General Configuration Tips

== Configuring Default Cluster Storage

When cluster is created, the default distribution zone is used for storage configuration. While we recommend creating distribution zones for your clusters, you can still use the default zone and configure it to suit your needs.

To get default storage configuration, use the `cluster config show zone command`. Here is an example of the default configuration:

[source, json]
----
"zone" : {
    "defaultDataStorage" : "aipersist",
    "defaultDistributionZone" : {
      "dataNodesAutoAdjust" : 2147483647,
      "dataNodesAutoAdjustScaleDown" : 2147483647,
      "dataNodesAutoAdjustScaleUp" : 0,
      "dataStorage" : {
        "dataRegion" : "default",
        "name" : "aipersist"
      },
      "filter" : "$..*",
      "partitions" : 25,
      "replicas" : 1,
      "zoneId" : 0
    },
    "distributionZones" : [ ],
    "globalIdCounter" : 0
  }
----

To change type of storage used for new distribution zones, change the `zone.defaultDataStorage` value to `aimem` or `rocksdb`. You can also change the default data region used for new distribution zones by setting the `zone.defaultDistrubutionZone.dataStorage.dataRegion` parameter. You will need to restart the cluster after changing the data region parameters.

You can also change these properties for link:sql-reference/distribution-zones[distribution zones] you have created for yourself.

You can get information about the data region by using the `cluster config show aipersist` CLI command. Here is how the default data region may look like:

[source, json]
----
{
  "checkpoint" : {
    "checkpointDelayMillis" : 200,
    "checkpointThreads" : 4,
    "compactionThreads" : 4,
    "interval" : 180000,
    "intervalDeviation" : 40,
    "logReadLockThresholdTimeout" : 0,
    "readLockTimeout" : 10000,
    "useAsyncFileIoFactory" : true
  },
  "defaultRegion" : {
    "replacementMode" : "CLOCK",
    "size" : 268435456
  },
  "pageSize" : 16384,
  "regions" : [ ]
}
----

To change the size of the default region, use the `cluster config update` command:

[source,shell]
----
cluster config update --url http://localhost:10300 {aipersist.defaultRegion.size:9999999}
----

== Configuring Local Paths

By default, all files generated by Apache Ignite are stored in the installation folder. However, depending on your environment, you may need to change the path to your files. You can use the `{IGNITE_HOME}\etc\vars.env` file to change the storage paths of your files. You can change paths to the following:

- Work directory, where data is stored.
- Log folder, where logs are placed.
- The folder from which libraries are loaded.
- The configuration file that is used to set up the default node.

== Configuring Client Logging

By default, Ignite 3 uses the `java.util.logging` (JUL) logging framework. Ignite uses the `etc/ignite.java.util.logging.properties` configuration, and outputs logs to the folder configured in the `LOG_DIR` variable that can be configured in the `etc/vars.env` file. By default, logs are stored in the `{IGNITE_HOME}/log` folder. You can provide a custom configuration file by using the `java.util.logging.config.file` property.

Some Ignite modules use libraries that rely on SLF4J logging. To gather logs from these libraries, add `org.slf4j:slf4j-jdk14:2.0.x` class to the classpath.

For more information on configuring JUL logging, see the link:https://docs.oracle.com/en/java/javase/11/core/java-logging-overview.html[Java Logging Overview] in Oracle documentation.

Ignite also supports other logging frameworks if you need to customize the logger.

=== LOG4J 2

To use log4j logging, include the required classes to the classpath:

- `org.apache.logging.log4j:log4j-slf4j2-impl:2.x.x`
- `org.apache.logging.log4j:log4j-api:2.x.x`
- `org.apache.logging.log4j:log4j-core:2.x.x`
- `org.apache.logging.log4j:log4j-jpl:2.x.x`

NOTE: We recommend using the latest version of log4j.

You can use custom configuration by using the Log4j configuration file. For more information on configuring Log4j logging, see the link:https://logging.apache.org/log4j/2.x/manual/configuration.html[Log4j Configuration] in Apache Log4j documentation.
