I want some ideas on how to do logging in EJB applications.I heard that log4j is a useful tool and tried it.Do you use the logger as it is or is it better to write a wrapper around it and then use it.Any ideas would be really helpful.Anybody working on EJB applications who is presently using log4j please give your ideas
We're using log4j with WebLogic. We've decided to use some wrappers. They target is not to wrap log4j, but to wrap some common behavior. For example we have some wrapping classes for performing common database operations (used by BMP entity beans). This allow us to log every select, insert, update etc. before it is sent to the database.
There are two main improvements of logging subsystem we are know thinking about:
- The automatic grouping of log info into business operations history (multiple log-lines = description of EJB method call)
- Displaying different descriptions of the same event for the different groups of people (customer care workers, programmers, system administrators). Our idea is to create full XML log and then use XSL to prepare different views.
ok, i got what u said but i need a suggestion.
Is it necessary to have a wrapper class around log4j or is it ok to have all classes including EJB creating instance of Category class for logging.
Sorry for late answer. I've just come back from unplugged holidays (sun, beach, no laptops).
I'm not sure that's the right answer but we are using wrappers (static methods form utility like classes) to hide log4j behind them (for example - creating Category etc.). The reason is:
- the ability to change logging mechanism