Comments (19)
From the discussion here: https://users.scala-lang.org/t/scribe-2-3-3-is-available/2675/4
Reopening the ticket.
from scribe.
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.
There are better ways to manage this with logging. Closing ticket.
from scribe.
For the archives; The lack of MDC makes Scribe unsuitable for our application which requires logging stuff in a way MDC facilitates.
from scribe.
@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.
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.
@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.
Specifically, take a look at the test for an example of usage: c52857f#diff-827f41ef68e5c0de3e996f25ceedc051R97
from scribe.
Looks great, will try it!
from scribe.
@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.
I will.
from scribe.
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.
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.
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.
@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.
Ok, thanks.
from scribe.
@andreak any updates on this?
from scribe.
I posted a question on the Gitter channel:-) That will allow me to use Scribe without too much manual refactoring.
from scribe.
The MDC-part is confirmed to work OK.
from scribe.
Related Issues (20)
- Scala Native performance issue (silent logs) HOT 16
- Release scribe for Scala Native v0.4.1 HOT 2
- sl4j support doesn't work with Java 11 HOT 5
- LogRecord Support for multiple Loggables HOT 1
- `message` `FormatBlock` is exported twice HOT 5
- SystemOutputLogger: option to always log to one stream HOT 7
- Add logical operators on `Filter` HOT 5
- File Rolling Not Prefixing HOT 1
- File Logging with Multiline Problems
- conflict with profig HOT 5
- Inconsistent formatting when log records contain data HOT 7
- Support outputting logstash formated logs to stdout HOT 12
- scribe-json ignores slf4j MDC values when outputting HOT 1
- scribe-interface
- scribe-file support for Scala.js using Node.js fs
- Eval Feature
- Formatter colors are not correctly resetted HOT 14
- scribe-cats scala-native artifacts HOT 1
- Support Same-Line logging
- Scribe chokes in both SBT and the IntelliJ console due to believing there's not enough columns HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.