Closed chris-hatton closed 2 years ago
it is a common java problem. there are two loggers registered. AntilogDebug add a new logger with default console handler to existing parent logger. you can change this behavior with following Kotlin code:
Napier.base(DebugAntilog("app", listOf(ConsoleHandler().apply {
level = Level.INFO
formatter = SimpleFormatter()
}))) // optional
val antilogLogger = Logger.getLogger(DebugAntilog::class.java.name)
antilogLogger.useParentHandlers = false
see last line. you have to set setUseParentHandlers to false see here
i think this should be documented in this project
Why on earth would I want to write that boilerplate in every project, just to get sane logging on Android, or have to know that 'the anti-log logger mustn't use parent handlers'?
Libraries are meant to help, not hinder.
Also reconsider the term 'Antilog' - what does this even mean? The English interpretation of this would be 'opposite to logging, against logging'. Hardly encouraging naming. Kermit manages to make this friendly and easy, why doesn't Napier?
For some reason, every Napier log in Androids LogCat is duplicated with these tags:
The double logging makes log output unreadable to the point I no longer want to use Napier. Are others experiencing this issue; and is there an easy resolution?
I/DebugAntilog
is expected; I can't see whyW/System.err
is being logged: This is for all log levels, not just warnings or errors.iOS logging is working as expected.