Comments (7)
Got tired of waiting. Released with 3.10.0
from scribe.
Hi! Thanks for the lib! As far as I can see it still will suffer from context switches? I.e. when a function executing in the future is getting moved to another execution thread? The MDC context for the function will not be preserved, right?
from scribe.
So, this was a bit of a half-measure. In order to share the context, you'd have to MDC.contextualize(mdc) { ... }
in the block you want to utilize it. I'll give this some more thought on coming up with a better way to do it. If you have any thoughts, they would be welcome.
from scribe.
What would you think about me adding:
(implicit mdc: MDC = MDC.global)
to all logging calls and allow an implicit MDC to be able to be picked up?
from scribe.
Hmm, not many ideas from my side. But maybe it's not the task for the logging library if it was not initial design choice. I heard that it should be possible to do with custom ExecutionContexts but I never was able to make it working... https://blog.knoldus.com/how-to-use-mdc-logging-in-scala/
from scribe.
I've added some new functionality to allow the use of implicits:
MDC { implicit mdc =>
mdc("key") = "value"
val f = Future {
scribe.info("this is a test")
}
Await.result(f, Duration.Inf)
}
The above will output with "key" = "value" in the logs. Would you say this adequately solves the problem? Of course, if you're working across multiple methods you'd have to pass around the implicit MDC.
from scribe.
@kell18 I'm planning to do a release this week, but I'd like confirmation that this update fulfills your needs?
from scribe.
Related Issues (20)
- Scala JS source maps, map to release dir? HOT 9
- No colours when run on Node.js HOT 14
- TASTy file was produced by Scala 3.2.0 HOT 7
- [Suggestion] improve JSON logging usability HOT 5
- REPL: scribe macro NPE when the scala source file is virtual HOT 2
- Include ISO8601 datetime formatters in core HOT 7
- Logstash encoding for stdout HOT 2
- Exceptions are not logged by SLF4JHelper since 3.9.0 HOT 5
- Unable to have minimumLevel=Info and only enable Trace for certain packages HOT 11
- Overriding the path for log files HOT 4
- Help: configure stdout/stderr in function of LogLevel HOT 15
- Compare perfomance with Chronicle-Logger HOT 2
- NPE when logging with SLF4J and Throwble == null HOT 4
- Different versions of scala-collection-compat pulled in transitively HOT 3
- Logger ignores `data` field HOT 3
- AsynchronousLogHandle shutdown hook HOT 3
- MDC syntax improvement HOT 7
- Standardize JSON output ? HOT 3
- Is it safe to use MDC with cats-effect? HOT 5
- Logging stderr HOT 2
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.