Gregg Wonderly wrote:
Mark Brouwer wrote:
Assume we change the hierarchy from:

  n.j.d.LookupDiscovery

to

  n.j.d.LookupDiscovery.eth0.unicast
  n.j.d.LookupDiscovery.eth0.multicast
  n.j.d.LookupDiscovery.eth1.unicast
  n.j.d.LookupDiscovery.eth1.multicast

and I want to apply a filter so that only log record with a level of
exactly FINEST are logged for discovery then I can't no longer apply
that filter on the logger named "LookupDiscovery".

The existing implementation of the java.util.logging allows you to say

net.jini.discovery.LookupDiscovery.level=FINEST

and that covers all in the hierarchy of names beyond that name. Are you referring to your filter mechanism that doesn't match the hierarchy?

Sorry for not being clear Gregg, another try.

I'm referring to an implementation of java.util.logging.Filter [1] that
is executed in the java.util.logging.Logger.log(LogRecord) method.
Opposed to the log level a filter are not inherited by a Logger from the
nearest parent that has a non-null Filter (semantics of Logger, so I'm
not deviating from the spec here).

When you create a deeper hierarchy of loggers for LookupDiscovery I
can't set these filters anymore on the LookupDiscovery node as the
logging will take place (at least that is what I assume) at a node that
is a child of LookupDiscovery, meaning I have to start setting filters
on each child node and that is my 'resistance' to a hierarchy in the
loggers for LookupDiscovery.

[1] Seven provides various implementation of java.util.logging.Filter
that can easily be applied to the logger nodes or log handlers, an
example is a regular expression filter so you can prevent from log
records that contain something like "network interface is bad" in their
message from being displayed. These can be applied during runtime to
troubleshoot.

BTW can you indicate whether when all the output is suppressed from the
incorrect configured or not disabled interfaces whether you still want
to have more hierarchy in the loggers.

Also, my logman.dev.java.net project has an example formatter that is used for logrecords displayed in its serviceUI. One setting of properties for the formatter causes it to display [n.j.d.LookupDiscovery]. It uses the first letter of all the components of the name except the last to shorten the display width.

Also neat feature Gregg, going to remember that one too, although there
is a chance of ambiguity when shortening the package names, but I guess
most times it won't be a problem.
--
Mark

Reply via email to