-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem using LogstashMarker #360
Comments
Thank you for reporting an issue. See the wiki for documentation and slack for questions. |
Marker is basically a wrapper around a string key. So I think the easiest would be to replace it with
Later the lib is converting it to a slf4j marker. Let me know if that approach works for you. |
I am using
to the lazily evaluated version. any suggestions would be appreciated |
How about:
|
Hi oshai, When using the deprecated form I've tried about every combination i can think of even if it doesn't make sense
but in all of them the output comes out as slight variations in the Is this something that would be fixed through customizing the LogstashEncoder in the logback.xml? I'm admittedly lost amongst a sea of knobs and dials and not sure which ones to turn. |
You can try the new
The You can see more examples (not exactly the same), at slf4j fluent logging: https://www.baeldung.com/slf4j-parameterized-logging#fluent-logging Regardless, I suggest to see if writing log messages directly to logback is doing what's expected to make sure it's not a configuration issue. |
The problem that it's not possible to use
Which simply doesn't seem to be true for Markers as of version 5.x anymore (without accessing the underlying logger). |
The this way you can log the following way
Unfortunately you would have to supply the throwable attribute though if you do not want to use a deprecated method. |
I was thinking about providing a PR containing just a marker and a message which would be more readable like this:
However if the deprecated methods, having the same signature, this wont be possible. The api could be improved a bit by not requiring the throwable, which could result in the following:
I will create a PR for that approach and see what @oshai thinks |
PR is created under #408 |
@ewoelfel that is also useful to have, but it doesn't solve this issue at all. |
That is true concerning the |
No, that wouldn't solve the issue either.
That's the opposite of what's needed. The way this problem could potentially be solved is to have another implementation of |
I see, maybe adding a new extenion-function similiar to this
could mitigate the issue. Maybe just for you or even as a PR. |
That would not solve the issues at all. Maybe actually take a look at The only way to do this, would be to wrap the I might create a PR for this, but I'm not sure when to find the time. |
Hi @oshai!
First of all, thank you for your work in the library!
I'm having an issue migrating to v5 and I can't seem to find a good approach to solve this problem.
We are using
LogstashMarker
s which is basically an implementation oforg.slf4j.Marker
interface provided by thelogstash-logback-encoder
library.Migrating to V5 from V3 is proving to be more difficult because the
KLogger
methods only accept aio.github.oshai.kotlinlogging.Marker
interface.In this case, how would you suggest to proceed? I tried looking into the documentation and other issues in the project but could not find any approach to this.
Thank you for time!
The text was updated successfully, but these errors were encountered: