Closed AObuchow closed 4 years ago
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 https://github.com/goxr3plus/java-stream-player/blob/1a32b14bb506d9588b035d5d136c8a930f3bc9d4/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L68
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 :) I was able to disable the logging by adding a log filter.
However, com.goxr3plus.streamplayer.stream.StreamPlayerEventLauncher
isin't getting filtered as its using system.out
. I can see that this was fixed, as mentioned in https://github.com/goxr3plus/java-stream-player/issues/23, however it seems that the latest version (9.0.4) of java-stream-player
available on https://jitpack.io/#goxr3plus/java-stream-player doesn't have this fix.
Would you kindly deploy the latest version of java-stream-player
to jitpack.io? :) That should fix my issue!
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., notifications@github.com 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 https://github.com/goxr3plus/java-stream-player/issues/60#issuecomment-606143673, 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 :) ). And for sure, I'll let you know if I encounter further bugs along the way :)
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., notifications@github.com 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 https://github.com/goxr3plus/java-stream-player/issues/60#issuecomment-606145869, 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
@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 :)
Thank you so much @goxr3plus for releasing version 10.0.0 (and also, congrats on the release 🎉!). Being a contributor will help if I find any bugs or potential improvements, so thank you! And in all honesty, I'm still a junior developer myself but I'm familiar with contributor guidelines (eg. I wouldn't think about merging something without approal) :)
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! :)
@AObuchow Don't worry when i started this library i was even more junior , i din't knew what static
means in Java :) ahahah
@AObuchow Don't worry when i started this library i was even more junior , i din't knew what
static
means in Java :) ahahah
Hahah okay :) We all have to start somewhere! :)
I haven't read the whole thread, but the start of it. You can disable logging by the StreamPlayer class, by using the constructor https://github.com/goxr3plus/java-stream-player/blob/1ec869bcd8fb4bc47c61ab4f3d8f369ad1e97703/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L151-L156
and call it with a logger that doesn't log. I've done that for testing purposes; an example can be found in https://github.com/goxr3plus/java-stream-player/blob/1ec869bcd8fb4bc47c61ab4f3d8f369ad1e97703/src/test/java/com/goxr3plus/streamplayer/stream/SourceDataLineTest.java#L22-L28
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!