# Logs

{% hint style="info" %}
Changes to the logback.xml are hot reloaded by the Agent, no need to restart.
{% endhint %}

All logs are emitted unbuffered as a stream of events to both stdout and to rotating files inside the directory **logs/**.

The **logback.xml** file is used to configure logging.

If customization is required, it is recommended to adapt the default configuration rather than write your own from scratch.

The file can be placed in any of the following directories:

* the directory where the Agent is started from
* /etc/lenses/
* agent installation directory.

The first one found, in the above order, is used, but to override this and use a custom location, set the following environment variable:

```bash
export LENSES_LOG4J_OPTS="-Dlogback.configurationFile=file:/path/to/logback.xml"
```

## Default configuration <a href="#default-configuration" id="default-configuration"></a>

The default configuration file is set up to hot-reload any changes every 30 seconds.

## **Log Level**

The default log level is set to `INFO` (*apart from some very verbose classes*).

## **Log Format**

All the log entries are written to the output using the following pattern:

```bash
%d{ISO8601} %-5p [%c{2}:%L] [%thread] %m%n
```

You can adjust this inside logback.xml to match your organization’s defaults.

## **Log Location**

**logs/** you will find three files: **`lenses.log`, `lenses-warn.log`** and **`metrics.log`**. The first contains all logs and is the same as the stdout. The second contains only messages at level WARN and above. The third one contains timing metrics and can be useful for debugging.

## **Log Buffering**

The default configuration contains two cyclic buffer appenders: "CYCLIC-INFO” and “CYCLIC-METRICS”. These appenders are **required** to expose the Agent logs within the Admin UI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenses.io/latest/deployment/configuration/agent/logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
