Re: servletcontext listener vs servlet with high priority on loading
markspace wrote:
a wrote:
I build my own version of Log Util based on the log4j. The purpose is fo=
r
convenience. It involves a lot of static method and static variable.
I think you have just discovered that home built frameworks like this
are often not more convenient. Please try the existing configuration fil=
es.
+1
With log4j, the same-named logger (i.e., via the class or class name you pa=
ss to the constructor) is the same logger instance. It is better to name a=
logger by the class that uses it, as documented in the log4j instructions.=
This helps ops to maintain the program. I don't know whose convenience y=
ou're trying to serve, "a", but I will bet dollars to doughnuts it's not th=
e folks whose convenience you ought to serve, namely the production personn=
el.
Logging isn't for programmers, it's for ops.
I expect objects can be instantiated in ServletContextListener, but not =
any
static in a class. Is that true? Pls explain.
I don't understand.
I wonder if "a" means that you cannot instantiate a logger as a static vari=
able, which of course is nonsense. You most definitely can, and sometimes =
should, instantiate a logger as a static variable.
If "a" refers to objects in general, then it's even more nonsensical. It's=
Java. Of course you can instantiate objects as static members.
Perhaps "a" ought to clarify his meaning. "a"?
Also, "a", I heartily recommend you read *and study* the documentation for =
log4j (or any other framework that you use).
--
Lew