---
title: Logback configuration
sidebar_label: Configure logback
---

Deephaven Core uses logback for logging, which reads initial configuration from a `logback.xml` file packaged with the server process and also permits changing log levels at runtime.

Note that logback changes logging levels for logger names, not directly for classes. A logger name may correspond to a specific class, but it may also be shared by multiple classes or represent a package-level logger. Many Deephaven classes, particularly ones imported from the Enterprise code base, use shared loggers. In those cases, you cannot change logging for only one class; you can only change the level for the shared logger name, which will affect every class that uses it.

## XML Configuration

The default file is located in `/usr/illumon/coreplus/latest/lib/Main-VAR::COREPLUS_DHC_VERSION-VAR::COREPLUS_DHE_VERSION.jar` as `logback.xml`. You can extract the default configuration with:

```bash
unzip -qc /usr/illumon/coreplus/latest/lib/Main-VAR::COREPLUS_DHC_VERSION-VAR::COREPLUS_DHE_VERSION.jar logback.xml | tee /tmp/logback.xml
```

After executing this command, `/tmp/logback.xml` will contain the default logback configuration, similar to:

```xml
<configuration debug="false">
  <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>

  <!-- The DH Enterprise specific logger appender, directing log messages to the Process Event Log (PEL).
       This appender starts as logging to stdout, and once main completes the somewhat involved
       PEL initialization, it switches to PEL. Since PEL logging requires network and a service,
       if there is a failure it reverts back to stdout logging. -->
  <appender name="PEL" class="io.deephaven.enterprise.dnd.ProcessEventLogAppender">
    <encoder>
      <pattern>%-20.20thread | %-25.25logger{25} | %m</pattern>
    </encoder>
  </appender>

  <!-- LogBuffer is a ring-buffer of recent log messages. It allows clients (such as the web console)
       to subscribe and display information. -->
  <appender name="LOGBUFFER" class="io.deephaven.logback.LogBufferAppender">
    <encoder>
      <pattern>%-20.20thread | %-25.25logger{25} | %m</pattern>
    </encoder>
  </appender>

  <!-- individual package levels can be changed -->
  <!--<logger name="io.netty" level="INFO"/>-->
  <!--<logger name="io.deephaven" level="INFO"/>-->

  <root level="info">
    <appender-ref ref="PEL" />
    <appender-ref ref="LOGBUFFER" />
  </root>
</configuration>
```

You can adjust the configuration, for example, by adding a `<logger>` element to change the logging level for a specific package. After making your adjustments, you can add the modified `logback.xml` file to a jar:

```bash
jar cf logback-xml.jar logback.xml
```

After creating the jar, you can put it in the `custom_lib` directory of your Core+ installation to override the default configuration.

```bash
sudo -u irisadmin cp logback-xml.jar /usr/illumon/coreplus/latest/custom_lib/
```

The new configuration takes effect for newly started workers; existing workers have already read the configuration file and do not update.

## Temporary log level changes

From Groovy, you can change the log level of individual classes at runtime. For example, to set the log level of `ConstructSnapshot` to `DEBUG`, you can run:

```groovy
org.slf4j.LoggerFactory.getLogger(io.deephaven.engine.table.impl.remote.ConstructSnapshot).setLevel(ch.qos.logback.classic.Level.DEBUG)
```

Similarly, from Python, you can use low-level jpy primitives to change the log level of a class. For example, to set the log level of `ConstructSnapshot` to `DEBUG`:

```python
import jpy

JLoggerFactory = jpy.get_type("org.slf4j.LoggerFactory")
JConstructSnapshot = jpy.get_type(
    "io.deephaven.engine.table.impl.remote.ConstructSnapshot"
)
JLevel = jpy.get_type("ch.qos.logback.classic.Level")
j_logger = JLoggerFactory.getLogger(JConstructSnapshot.jclass)
j_logger_casted = jpy.cast(j_logger, jpy.get_type("ch.qos.logback.classic.Logger"))
j_logger_casted.setLevel(JLevel.DEBUG)
```

## Related documentation

- [Custom Core+ libraries](../installation/customize-basic-install.md#custom-libraries)
- [ProcessEventLog](../internal-tables/process-event-log.md)
