How to configure slf4j-simple
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
slf4j-simple is the minimal SLF4J binding for applications that just need straightforward console logging. It is useful for small services, utilities, tests, and demos where a full logging framework would be unnecessary overhead. The important part of configuring it is understanding that you are selecting one SLF4J backend and controlling it mostly through system properties or a simplelogger.properties file.
Add Exactly One SLF4J Binding
Start by depending on slf4j-api and slf4j-simple together.
For Maven, the same idea applies.
Only one binding should be active at runtime. If you also pull in Logback or another SLF4J backend, SLF4J will warn about multiple bindings and your logging setup becomes ambiguous.
Configure with simplelogger.properties
A common approach is putting a simplelogger.properties file on the runtime classpath.
Place that file in src/main/resources so it is included in the built artifact. This gives you one central logging policy for the application.
System Properties Also Work Well
For command-line tools or temporary overrides, configuration through JVM system properties is often more practical.
This is useful in CI jobs or local debugging sessions because you can change logging without rebuilding the application or editing packaged resources.
Use SLF4J Normally in Code
Once the binding is present, application code uses the standard SLF4J API.
That is the point of SLF4J: the code stays written against the facade, while the runtime chooses the backend.
Know What slf4j-simple Is Good At
slf4j-simple is intentionally limited. It is a good fit when you want:
- one lightweight backend
- console output
- basic level control
- minimal setup
It is not the right choice if you need rolling files, structured appenders, asynchronous logging, or complex routing. In those cases, use a richer backend such as Logback.
The configuration question is therefore partly architectural. slf4j-simple is simple because it omits advanced features, not because those features are hidden somewhere in a more complicated config file. That tradeoff is often a feature in command-line tools and tests, where fewer moving parts make troubleshooting easier.
Keep Package-Level Overrides Targeted
Per-package log levels are helpful, but use them narrowly. Turning an entire dependency tree to debug can bury the signal in noise.
That sort of targeted override is more sustainable than one global debug setting for everything.
Common Pitfalls
- Including multiple SLF4J bindings and ignoring the startup warnings.
- Expecting
slf4j-simpleto support advanced features such as rolling files or complex appenders. - Placing
simplelogger.propertiessomewhere that is not actually on the runtime classpath. - Using only global log levels and then drowning in noise from dependencies.
- Writing code against a concrete logger implementation instead of the SLF4J API.
Summary
- Add
slf4j-apiplus exactly one runtime binding, in this caseslf4j-simple. - Configure it through
simplelogger.propertiesor JVM system properties. - Keep application code on the SLF4J facade, not a concrete backend API.
- Use package-level overrides when you need focused debugging.
- Choose
slf4j-simpleonly when lightweight console logging is genuinely enough.

