Skip to content

Logging

Francesco Palozzi edited this page Jun 5, 2026 · 1 revision

Logging

RNA2DUnifier uses SLF4J as its logging façade, backed at runtime by Logback (included as a compile-scope dependency). All listener classes emit structured log messages during parsing.


Log Levels

Level When it appears
TRACE Fine-grained mapping of individual residues to zero-based indices.
DEBUG Entry/exit of parse sections (residue block, stacking lines, pair lines).
INFO Summary messages at the end of parsing (sequence length, total pairs counted).
WARN Non-fatal anomalies: malformed tokens, skipped uncommon residues, residue number gaps, unrecognised bond strings, pairs whose residues cannot be resolved.

Configuring Logback

Place a logback.xml (or logback-test.xml for tests) on the classpath. Example — route all RNA2DUnifier logs to the console at INFO level:

<configuration>
 
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} – %msg%n</pattern>
        </encoder>
    </appender>
 
    <!-- Set the level for all RNA2DUnifier parsers -->
    <logger name="it.unicam.cs.bdslab.rna2dunifier" level="INFO"/>
 
    <root level="WARN">
        <appender-ref ref="CONSOLE"/>
    </root>
 
</configuration>

To enable detailed TRACE output for a specific parser (e.g., mc-annotate):

<logger name="it.unicam.cs.bdslab.rna2dunifier.listeners.mcAnnotate" level="TRACE"/>

Using a Different Backend

Because RNA2DUnifier depends only on slf4j-api, you can replace Logback with any SLF4J-compatible implementation. If your project already uses Log4j 2, add the log4j-slf4j2-impl bridge and exclude logback-classic:

<dependency>
    <groupId>it.unicam.cs.bdslab</groupId>
    <artifactId>rna2d-unifier</artifactId>
    <version>0.0.1</version>
    <exclusions>
        <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Silencing All Logs

To suppress all RNA2DUnifier output programmatically (no configuration file needed):

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import org.slf4j.LoggerFactory;
 
Logger root = (Logger) LoggerFactory.getLogger("it.unicam.cs.bdslab.rna2dunifier");
root.setLevel(Level.OFF);

Auto-Detection | Next: Error Handling

Clone this wiki locally