GithubHelp home page GithubHelp logo

StaticMDCBinder Warning about scribe HOT 19 CLOSED

outr avatar outr commented on June 4, 2024
StaticMDCBinder Warning

from scribe.

Comments (19)

darkfrog26 avatar darkfrog26 commented on June 4, 2024 1

From the discussion here: https://users.scala-lang.org/t/scribe-2-3-3-is-available/2675/4

Reopening the ticket.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

I'm not sure I agree with the ideology behind MDC. Moving this out of 2.0 until a valid reason can be given to support it.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

There are better ways to manage this with logging. Closing ticket.

from scribe.

andreak avatar andreak commented on June 4, 2024

For the archives; The lack of MDC makes Scribe unsuitable for our application which requires logging stuff in a way MDC facilitates.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

@andreak, do you care about thread-safety? Does it matter if it is a proper MDC implementation (for SLF4J integration) or a better solution that provides the same functionality?

from scribe.

andreak avatar andreak commented on June 4, 2024

If by thread-safety you mean that the values of MDC-properties are thread-local only and never change for the lifetime of the thread then yes. Mind you that many webservers use a threadpool for handling HTTP-requests, hence reusing threads, so it's important to be able to "install" and "clear" the values of the "current-thread"'s MDC-properties. This is usually done in ServletFilters.

It's hard to tell if compatibility with SLF4J/Log4J matters before I get to try it with MDC-ish support. We use lots of 3rd-party libs (and have som legacy JAVA-code) which use Log4J (configured thru log4j.xml) and it'd be cool not to have separate log-files for parts logging with Scribe and legacy-style.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

@andreak take a look at c52857f and let me know if this fulfills your requirements

It provides a proper implementation of SLF4J's MDC support while also providing a cleaner interface for use in Scala directly.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

Specifically, take a look at the test for an example of usage: c52857f#diff-827f41ef68e5c0de3e996f25ceedc051R97

from scribe.

andreak avatar andreak commented on June 4, 2024

Looks great, will try it!

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

@andreak please confirm after you've had a look and I'll roll it out in 2.3.4 as it has no breaking changes

from scribe.

andreak avatar andreak commented on June 4, 2024

I will.

from scribe.

andreak avatar andreak commented on June 4, 2024

I'm not able to compile scribe:

sbt:scribe> compile
[info] Compiling 5 Scala sources to /home/andreak/dev/scribe/slf4j/target/scala-2.12/classes ...
[error] /home/andreak/dev/scribe/slf4j/src/main/scala/scribe/slf4j/ScribeMDCAdapter.scala:10:60: missing argument list for method update in object MDC
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `update _` or `update(_,_)` instead of `update`.
[error]   override def put(key: String, `val`: String): Unit = MDC.update(key) = `val`
[error]                                                            ^
[error] one error found
[error] (slf4j / Compile / compileIncremental) Compilation failed
[error] Total time: 1 s, completed 27.apr.2018 10:48:45

When I import the project in IDEA I get undefined import scribe.MDC, it seems the slf4j module somehow is not dependent on core.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

Sorry about that. In my rush to knock this out, I didn't properly test it. If you update the project it should work now.

from scribe.

andreak avatar andreak commented on June 4, 2024

Thanks, got it to build now. I'll spend some time this weekend integrating it with our application and see how it works. I'll report back.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

@andreak drop me a message on Scribe's Gitter channel if you run into any problems and I'll respond when I can.

from scribe.

andreak avatar andreak commented on June 4, 2024

Ok, thanks.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

@andreak any updates on this?

from scribe.

andreak avatar andreak commented on June 4, 2024

I posted a question on the Gitter channel:-) That will allow me to use Scribe without too much manual refactoring.

from scribe.

andreak avatar andreak commented on June 4, 2024

The MDC-part is confirmed to work OK.

from scribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.