-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Is there a way to disable the logger? #60
Comments
Hm , can you send me a screenshot , like what it outputs , it's been a long time an i forgot the code :) |
I had a look on the code java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java Line 68 in 1a32b14
Try searching on web how to disable specific logger , or completely from the application the loggers if you don't need . I am not sure if i have the most right Logging architecture for this project , i was Junior Developer when i wrote this :) |
Thanks for the quick reply @goxr3plus :) However, Would you kindly deploy the latest version of |
Hm you are right, since then @HelgeStenstrom did a ton of updates and we need a new release along with a small guide with examples on how to use . |
Glad we found the source of the problem! I'm sure the new updates will be greatly appreciated by users of the library :) Do you think you would be able to release it before adding the guides/examples on how to use? (Perhaps hold off on updating the artifact version used in the README until the guides are ready, but do a silent release?) |
Well i can even release tommorow but i have not tested it, if you are
willing to use it and along the way tell me if it works correctly i will do
that for you :)
…On Mon, 30 Mar 2020, 20:44 Andrew O., ***@***.***> wrote:
Glad we found the source of the problem! I'm sure the new updates will be
greatly appreciated by users of the library :)
Do you think you would be able to release it before adding the
guides/examples on how to use? (Perhaps hold off on updating the artifact
version used in the README until the guides are ready, but do a silent
release?)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#60 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3OFQCKSZSE7ASZJCWOJPTRKDLBTANCNFSM4LWGT6MQ>
.
|
I can definetly wait till tomorrow (or even longer, as I understand we all have our own lives/priorities and you're already doing me a big favour :) ). |
I am a web developer now, i have to refresh a little bit my brain cache
memory with Java.
…On Mon, 30 Mar 2020, 20:49 Andrew O., ***@***.***> wrote:
I can definetly wait till tomorrow (or even longer, as I understand we all
have our own lives/priorities and you're already doing me a big favour :) ).
And for sure, I'll let you know if I encounter further bugs along the way
:)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#60 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3OFQEGBL52OIVTB4XSNZ3RKDLRFANCNFSM4LWGT6MQ>
.
|
@AObuchow I just released version 10.0.0 , would you like to be a contributor on this project ? I will send you now invitation link . You can modify stuff around and send me a pull request , i think you are a senior developer based on your github profile :) |
I send you collaborator link , please be careful what you modifying :) , get the latest release from jitpack => https://jitpack.io/private#goxr3plus/java-stream-player/10.0.0 |
Thank you so much @goxr3plus for releasing version 10.0.0 (and also, congrats on the release 🎉!). |
Thank you! :) |
@AObuchow Don't worry when i started this library i was even more junior , i din't knew what |
Hahah okay :) We all have to start somewhere! :) |
I haven't read the whole thread, but the start of it. java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java Lines 151 to 156 in 1ec869b
and call it with a logger that doesn't log. I've done that for testing purposes; an example can be found in java-stream-player/src/test/java/com/goxr3plus/streamplayer/stream/SourceDataLineTest.java Lines 22 to 28 in 1ec869b
You can use any class that extends Logger. |
@HelgeStenstrom Thank you so much for the tip! This seems to be a nicer solution than adding a log filter, I'll give it a try tonight :) |
@goxr3plus BTW, I just started using version 10.0.0 and it's working as expected 🎉 |
@HelgeStenstrom passing a logger that doesn't log in the StreamPlayer constructor works perfectly! Thanks for the advice. |
This is written in Kotlin but this is how you can remove the loggers with DeclaredField: val disableStreamPlayerLogger = {
val loggerField = StreamPlayer::class.java.getDeclaredField("logger")
loggerField.isAccessible = true
val logger: Logger = loggerField.get(streamPlayer) as Logger
logger.useParentHandlers = false
}
val disableOutletLogger = {
val loggerField = Outlet::class.java.getDeclaredField("logger")
loggerField.isAccessible = true
val logger: Logger = loggerField.get(streamPlayer.outlet) as Logger
logger.useParentHandlers = false
}
disableOutletLogger()
disableStreamPlayerLogger() Java version(converted using ChatGPT): public static void disableStreamPlayerLogger() throws NoSuchFieldException, IllegalAccessException {
Field loggerField = StreamPlayer.class.getDeclaredField("logger");
loggerField.setAccessible(true);
Logger logger = (Logger) loggerField.get(streamPlayer);
logger.setUseParentHandlers(false);
}
public static void disableOutletLogger() throws NoSuchFieldException, IllegalAccessException {
Field loggerField = Outlet.class.getDeclaredField("logger");
loggerField.setAccessible(true);
Logger logger = (Logger) loggerField.get(streamPlayer.outlet);
logger.setUseParentHandlers(false);
} |
First off, I just wanted to say this library is perfect for my needs - it's a really awesome project!
I'm using it to build a music player which has a command line interface, and have an issue where the logger from
com.goxr3plus.streamplayer.stream.StreamPlayer
is outputting to stdout, which is cluttering the UI.Is there a way to disable logging? Or redirect it to a file perhaps?
I tried disabling it from my code which uses
java-strean-player
but was unsuccesful.I would also be willing to submit a PR if required for this :)
Thank you!
The text was updated successfully, but these errors were encountered: