Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: servletcontext listener vs servlet with high priority on loading Date: Thu, 11 Aug 2011 12:51:44 -0700 (PDT) Organization: http://groups.google.com Lines: 42 Message-ID: <35db14aa-dcbd-44ab-86eb-2b3695a58bf3@glegroupsg2000goo.googlegroups.com> References: <1VO0q.42336$nj1.39176@newsfe19.iad> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 2620:0:1000:437c:224:d7ff:fe69:5838 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1313093282 20355 127.0.0.1 (11 Aug 2011 20:08:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 11 Aug 2011 20:08:02 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2620:0:1000:437c:224:d7ff:fe69:5838; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7028 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. >=20 > I think you have just discovered that home built frameworks like this=20 > 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. >=20 > 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). --=20 Lew