Logging & Debugging

Koin Logger

Setup Koin Logging

Logging & Definitions resolution

Koin has an active logging to help understand how bean definitions are resolved:

(KOIN) :: Resolve [org.koin.test.standalone.MVPArchitectureTest.Presenter] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.Presenter]
(KOIN) :: 	Resolve [org.koin.test.standalone.MVPArchitectureTest.Repository] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.Repository]
(KOIN) :: 		Resolve [org.koin.test.standalone.MVPArchitectureTest.Datasource] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.DebugDatasource, binds~(org.koin.test.standalone.MVPArchitectureTest.Datasource)]
(KOIN) :: 		(*) Created
(KOIN) :: 	(*) Created
(KOIN) :: (*) Created
(KOIN) :: Resolve [org.koin.test.standalone.MVPArchitectureTest.Repository] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.Repository]
(KOIN) :: Resolve [org.koin.test.standalone.MVPArchitectureTest.DebugDatasource] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.DebugDatasource, binds~(org.koin.test.standalone.MVPArchitectureTest.Datasource)]
(KOIN) :: Resolve [org.koin.test.standalone.MVPArchitectureTest.Presenter] ~ Bean[class=org.koin.test.standalone.MVPArchitectureTest.Presenter]

Each tab space indicates a new resolution

Each (*) Created indicates a new instance has been created

Crash logging

When a bean defintion lead to an error (error while getting new definition or else), a stacktrace of error is done:

org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=org.koin.test.core.BadInstanceCreationTest.ComponentE] due to error :
	org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=org.koin.test.core.BadInstanceCreationTest.ComponentD] due to error :
	org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=org.koin.test.core.BadInstanceCreationTest.ComponentE] due to error :
	org.koin.error.DependencyResolutionException: Cyclic dependency detected while resolving class org.koin.test.core.BadInstanceCreationTest$ComponentD

The basic JVM stracktrace is also available in the logs.