Make use of categories instead of fqcn for logging

Description

http://community.jboss.org/wiki/HowToLogInJBossProjects

We need to define the set of categories we wish to have
eg:

  • org.hibernate.search.query

  • org.hibernate.search.hcore

  • org.hibernate.search.batchindexing etc

The idea behind category is that they are more stable than classes and thus better for the user

WDYT?

Environment

None

Activity

Show:
Hardy Ferentschik
July 6, 2011, 3:38 PM

I still think there is a usecase for fqcn in logging, especially when it comes to trace/debug messages. This might mean that we potentially need to loggers per class. Categories should be used for messages intended for the user. If possible categories should be "type-safe" and they should be listed and explained on the wiki - http://community.jboss.org/wiki/ContributingtoHibernateSearch .

Hardy Ferentschik
July 6, 2011, 3:46 PM

Maybe we could extend our org.hibernate.search.util.logging.impl.LoggerFactory. We could introduce a category enum and a new make method which takes the category as parameter.

Sanne Grinovero
July 6, 2011, 4:05 PM

I agree with the general idea. Also we had this nice trick in place to generate the category dinamically from a stacktrace; this was quite clever but is generating lots of stacktraces which slowdown the boot process; not really AS7 compliant

+1 for the Enum, love the idea.

Emmanuel Bernard
July 6, 2011, 6:20 PM

One problem with enums is that other modules will need to declare their category on core.
Better have an Interface category (with a toString() method essentially) and various module specific enums implementing it.

Sanne Grinovero
July 6, 2011, 6:27 PM

right. still we can follow this approach: there's no need to mandate other modules to use the same factory.
I've seen in Infinispan people extend the interface of the core module defining the error messages, in the hope that some can be reused. I never did this work out in practice so they can be totally independent IMHO.

Assignee

Unassigned

Reporter

Emmanuel Bernard

Labels

None

Suitable for new contributors

Yes, likely

Pull Request

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure