• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Closed Source Java Library spamming annoying Log messages

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I work on a closed source Kotlin app, which needs to use a couple of closed source third party libraries, still maintained in Java. One of these libraries is constantly logging a very annoying message.

Can't find resource for bundle java.util.PropertyResourceBundle, key BUILD

I cannot and do not want to fix the third party library's bytecode to not output this message.
I cannot ask the third party maintainer to fix it, because the maintainer wouldn't fix it.
The third party library runs perfectly fine. The message does not help, at all. It's just annoying to see and does not indicate any failure of any importance whatsoever.

All I want is to stop the JVM from outputting the message. I want it to detect that message with that particular content, always.
Other log messages from the same logger are not necessary, but fine. I just don't want to see the above message, anymore. (If that means, blocking the whole logger from working, so be it.)

The biggest issue with that log message is the fact, that it clutters the log way too much and significantly reduces the possibility of noticing actual errors of actual importance.
The logs are shown in an environment, which does not allow easy log filtering or anything like that.

All solutions I have found are forcing the third party maintainer to change the code or adjust settings. However, in this case, this is not possible.

Ideally, there should be a way to detect the logger, then catch then message and "mute" it.
Ideally, I could just detect the logger in my first party Kotlin code, then mute that message and be done.
 
Saloon Keeper
Posts: 24295
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java logging typically is designed in 2 parts:

1. The part that deals with creating and emitting messages to a logger.

2. The part that deals with routing log messages to an output channel(s) - also known as the appender.


You normally connect loggers with appenders by associating appender(s) with logger IDs, which are complete or partial logger names. For example, "org.hibernate" would report everything logged inside all the Hibernate libraries, but "org.hibernate.sql" would log only hibernate-generated SQL and related information. Thus, if an entire component of a product produces an annoying log message, often you can just adjust your appender associations to ignore that component.

But what if there's a case where you want to be selective within a component. For example, you don't want to see org.hibernate SQL for SQL INSERT statements, just UPDATE or DELETE?

In this case, your best bet might be to create a custom appender. An appender is basically just a channel that takes in log messages and sends them to a destination, which can be a file, an email, a network port, or any other destination you can think of. So you can code your own appender - from scratch, by cloning existing source or by subclassing and have it simply discard the offending messages.
 
Rancher
Posts: 157
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a guess: The message warns about a resourcebundle not found. So there's something missing the lib expect to be present. Or, seen from a different point of view: it sounds more like the lib is not used correctly. Instead of try to tinker with the symptoms you should figure out the cause.
Also: if that message keeps spamming this means lines that require it keep getting called - are there any loops or threads being started causing it?
 
Akito Kitsune
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Bendford wrote:Just a guess: The message warns about a resourcebundle not found. So there's something missing the lib expect to be present. Or, seen from a different point of view: it sounds more like the lib is not used correctly. Instead of try to tinker with the symptoms you should figure out the cause.
Also: if that message keeps spamming this means lines that require it keep getting called - are there any loops or threads being started causing it?



Yes, that's what I always do, when it's possible to do it right. However, this issue is not worth investing time and resources in. It does not cause any harm or any problem whatsoever. So, already using a workaround like the one proposed by Tim (I still have to try it out) already uses up a bigger than appropriate amount of time.
Situations like this are always a matter of what you lose versus what you get. If I spend hours on finding the root cause, just to get rid of a log message, then it's simply not worth it in the real, non-ideal, world.

As for your question:
The message appears pretty much all the time, except the app is doing specific blocking work. However, when it's "idling" (it does non-blocking stuff from time to time) it spams this message all the time, without seeming to be caused by a specific component or part. This is just an observation, though and I did not confirm that assumption's preciseness.
 
Tim Holloway
Saloon Keeper
Posts: 24295
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An observation, though. Stuff like this often turns out to be the ticking of a time bomb and good old Murphy says that the best time for a bomb to go off is when it's least convenient (and most embarrassing). The "Git 'Er Dun!" approach to IT has always annoyed me and besides it's one of the reasons why developers get no respect and software is widely considered to be unreliable.
 
Matthew Bendford
Rancher
Posts: 157
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's just not enough details to provide useful help.
At least to me it sounds the lib is not used correctly. Mute down its log message doesn't sound right to me, instead the cause should be fixed.
Just out of curiosity: What's the lib causing that spam? If you're about to reply with "I can't tell" - well I guess mine would be: "Then I can'T help".
 
reply
    Bookmark Topic Watch Topic
  • New Topic