Possible issue with Logging trait
See original GitHub issueI apologize in advance if I’m off base here, I know very (VERY) little about scala macros, and not much more about java’s invoking of virtual (?) / overridden methods.
I ran into issues where a parent class/trait extended the Logging trait and then the concrete class defined the logger method (manually or using slf4j LazyLogging or StrictLogging). Any usage of that logger in the parent class seems to be calling com.typesafe.scalalogging.Logger’s methods - which are “???” and throw a NotImplementedError, instead of calling the overridden macro method from the slf4j Logger.
I simplified this issue and replicated in the REPL:
scala> val logger = com.typesafe.scalalogging.slf4j.Logger(org.slf4j.LoggerFactory getLogger "test")
scala> (logger: com.typesafe.scalalogging.Logger) info "uheot"
scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252)
at com.typesafe.scalalogging.BaseLogger.info(Logger.scala:95)
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Possible issue with Logging trait #16 - GitHub
I ran into issues where a parent class/trait extended the Logging trait and then the concrete class defined the logger method (manually or...
Read more >Problem when defining a Logging trait in scala - Stack Overflow
I could achieve this effect using loggers in companion objects: object A extends Logging; class A { import A._ log.debug("log from A") } ......
Read more >Logging Trait - Apache Camel
The Logging trait is used to configure Integration runtime logging ... This trait is available in the following profiles: Kubernetes, Knative, OpenShift.
Read more >Logging - OWASP Cheat Sheet Series
Which events to log¶ · Sequencing failure · Excessive use · Data changes · Fraud and other criminal activities · Suspicious, unacceptable or...
Read more >Scala Logging | How Logging Work in Scala with Examples
Inside this package com.typesafe.scalalogging it provides us two traits which are Strict Logging and Lazy Logging and they are responsible to define the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Beware @gshakhn: I believe the
com.typesafe.scalalogging.slf4j.Logger
class no longer exists in the newscala-logging
artifact - it was renamedLazyLogger
. So it’s likely you are picking up that class from the oldscalalogging
artifact which is being imported via a transitive dependency from some other library.scala-logging-slf4j:2.1.2
still depends on troublesomescala-logging-api_2.11
, which causes the following error:The workaround (for scala 2.11):
Or should we not include
scala-logging-slf4j
altogether?