Differences from Spring
spring_boot_starter_logging follows Spring Boot's logging with Logback: the same logging.* properties, the same default lines, Logback's pattern syntax. This page lists where it does not, and why.
Why
There is no Logback in Dart, no SLF4J, no caller data and no time zone database. The starter reproduces what an application sees (the lines, the properties), and leaves out what depends on the JVM.
Example
A Spring Boot configuration that works unchanged, except the one renamed key:
logging.level.root=info
logging.level.neon.checkout=debug
logging.pattern.console=%d{HH:mm:ss.SSS} %clr(%5p) [%logger{20}] %m%n
logging.file.name=logs/shop.log
# Spring Boot: logging.logback.rollingpolicy.max-file-size=10MB
logging.file.rolling-policy.max-file-size=10MB
Configuration
| Spring Boot | Here | Why |
|---|---|---|
logging.logback.rollingpolicy.* |
logging.file.rolling-policy.*; the old names stop the start and name the new ones |
There is no Logback |
logback.xml, logback-spring.xml, logging.config |
Not supported; appenders are added in code | No XML configuration |
logging.structured.* |
Not supported | |
spring.output.ansi.enabled defaults to detect |
Defaults to always (never on iOS, whose log shows the codes as text) |
Flutter's tools show colours |
| Lines logged before the logging system starts are lost or printed plainly | Replayed into the file, the buffer and added appenders (Spring Boot's DeferredLogs); the console showed them already |
Patterns
| Spring Boot | Here | Why |
|---|---|---|
A pattern's final %n ends the line |
One line per record: the console and the file add the line break, so the final %n is dropped |
print adds the line break |
%thread is the thread |
The isolate name (main, isolate-2) |
Dart has isolates, not threads |
%X prints k=v, k=v |
{k=v, ...} with a leading space, nothing when there are no fields |
Readable after the message |
%C, %M, %L, %F, %caller |
Stop the start as unknown words | A Dart record does not know where it was logged |
%marker, %contextName |
Not supported | |
%d with any time zone |
UTC only | No time zone database |
%kvp prints SLF4J key-value pairs |
Prints the record's fields | Dart has no SLF4J |
%prefix, %property |
%prefix names conversions by Logback's long names; %property reads the pattern variables, then the environment |
|
| A pattern without colours stays plain | A console pattern that colours nothing gets Spring Boot's colours (time faint, level by level, logger cyan) |
Files
| Spring Boot | Here |
|---|---|
Rolling by date and size, into file-name-pattern (dates, %i, .gz) |
By size only, into numbered files (shop.log.1, .2); file-name-pattern is ignored with a warning |
max-history counts days |
Counts files |
| Archives can be compressed | Not compressed |
Any Java charset in logging.charset.file |
UTF-8, ISO-8859-1, US-ASCII; unencodable characters become ?, as in Java |
logging.charset.console sets the console's charset |
Only checked: the console is print, which writes text |
| An empty pattern: Logback reports a status error | An empty logging.pattern.console= or logging.pattern.file= turns that output off |
| Files on any JVM | Not on the web: logging.file.* is ignored with a warning |
Groups and levels
The predefined web and sql groups exist (spring.web, spring.websocket; spring.jdbc.core.JdbcTemplate, spring.jdbc.core.StatementCreatorUtils). Logger names are Dart names, so logging.level.org.springframework has no effect.
Only here
LogBufferandLogQuery, for an in-app log screen.logging.buffer.*andlogging.threshold.buffer.LoggingSystem.fileDirectory, for a Flutter app's writable directory.