https://kotlinlang.org logo
#ktor
Title
# ktor
a

Ankit Dubey

06/11/2021, 4:31 AM
Hi everyone, I’m facing error while calling Ktor API
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
This error doesn’t come when i pass HashMap<String, String> to body But whenever i’m passing,
HashMap<String, Any>
then only getting error. Any idea? Do I need to add SLF4J dependency🤔
a

andylamax

06/11/2021, 6:25 AM
That error usually gets printed if you haven't added the slf4j dependency.
It has nothing to do with your HashMap
Also, it is just a warning. If you don't need such logging you can ignore it
a

Ankit Dubey

06/11/2021, 6:45 AM
No It’s just not a warning. I think API was not called due to this error.
a

andylamax

06/11/2021, 6:47 AM
You say the error doesn't come when you pass a HasMap<String,String>, right. Pass that and loom at your console
a

Ankit Dubey

06/11/2021, 7:19 AM
HashMap<String,String> is working fine for many APIs Actually hashMap for some request had nested map also So I needed HashMap<String, Any> Anyhow , I replaced HashMap with one model class And passing that class into request body So working fine for now.
r

Rustam Siniukov

06/14/2021, 11:07 AM
This log is printed by slf4j when there is no logging dependency found. It’s not related to you API. Add one of the required dependencies, for example
ch.qos.logback:logback-classic:1.2.3
and you will see real error logs.
👍 2
534 Views