[ en | ru ]
Nanolog — is a simple but powerful logger for Java applications, compatible with SLF4J, that removes the need for static logger instances in every class requiring logging.
Nanolog provides an advanced API for application logging, offering additional features not found in other popular logger implementations:
- Automatic caller class detection
- Lazy message initialization via Supplier
- Parameterized message support
- Safe object-to-string conversion
- Easy creation of custom logger implementations
Nanolog is an extremely lightweight library and can be used as a standalone logger. However, it also supports integration with SLF4J, enabling compatibility with other logging libraries that act as its bridges — such as Logback, Log4j, JBoss Logging, and others.
Nanolog compatible with Java 8+.
The latest stable version of the library is 1.0.
The latest development version is 1.1-SNAPSHOT.
package com.nanolaba.logging.examples;
import com.nanolaba.logging.*;
public class QuickStart {
public static void main(String[] args) {
try {
// This is the logger used by default
LOG.init(new ConsoleLogger());
// If you want to use SLF4J
LOG.init(new Slf4jLogger());
// If you want to write your own logger, use a lambda function
// or implement the ILogger interface.
LOG.init(entry -> System.err.println(entry.getLevel() + " - " +
entry.getSourceClass() + " - " +
entry.getFormattedMessage()));
LOG.debug("A static logger variable is not needed");
LOG.info(String.class, "But you can explicitly specify which class the logging should belong to");
LOG.warn("This is a parameterized message: {}, {}, {} ",
100, "foo", new Object[]{"foo", "bar"});
if (LOG.isDebugEnabled()) {
LOG.debug("You can check if a log level is enabled in the standard way: " +
hugeComputations());
}
LOG.debug(() -> "It's also possible to pass a lambda expression: " +
hugeComputations());
} catch (Exception e) {
LOG.error(e);
}
}
private static String hugeComputations() {
return "OK";
}
}Maven (pom.xml)
<dependency>
<groupId>com.nanolaba</groupId>
<artifactId>nanolog</artifactId>
<version>1.0</version>
</dependency> Gradle (build.gradle)
dependencies {
implementation 'com.nanolaba:nanolog:1.0'
}Manual download
Get the JAR from Maven Central. Add it to your project's classpath
To use the latest development version in your project, you need to specify the snapshot
repository URL and then add a dependency with the -SNAPSHOT suffix:
Maven (pom.xml)
<repositories>
<repository>
<id>central.sonatype.com-snapshot</id>
<url>https://central.sonatype.com/repository/maven-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependency>
<groupId>com.nanolaba</groupId>
<artifactId>nanolog</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency> Gradle (build.gradle)
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
implementation 'com.nanolaba:nanolog:1.1-SNAPSHOT'
}📌 ⌛ Not done yet...
📌 ⌛ Not done yet...
📌 ⌛ Not done yet...
📌 ⌛ Not done yet...
📌 ⌛ Not done yet...
Last updated: 07.07.2025