Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7028

Re: servletcontext listener vs servlet with high priority on loading

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 <lewbloch@gmail.com>
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> (permalink)
References <1VO0q.42336$nj1.39176@newsfe19.iad> <j20nkr$lq2$1@dont-email.me> <j2181n$1cb9$1@adenine.netfront.net> <j219r2$jpa$1@dont-email.me>
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 <j219r2$jpa$1@dont-email.me>
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

Show key headers only | View raw


markspace wrote:
> a wrote:
>> I build my own version of Log Util based on the log4j. The purpose is for
>> 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 files.

+1

With log4j, the same-named logger (i.e., via the class or class name you pass 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 you're trying to serve, "a", but I will bet dollars to doughnuts it's not the folks whose convenience you ought to serve, namely the production personnel.

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 variable, 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

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

servletcontext listener vs servlet with high priority on loading "a" <a@mail.com> - 2011-08-11 04:18 -0700
  Re: servletcontext listener vs servlet with high priority on loading jaap <niemand@meel.homelinux.net> - 2011-08-11 14:37 +0200
  Re: servletcontext listener vs servlet with high priority on loading markspace <-@.> - 2011-08-11 07:06 -0700
    Re: servletcontext listener vs servlet with high priority on loading "a" <a@mail.com> - 2011-08-11 11:46 -0700
      Re: servletcontext listener vs servlet with high priority on loading markspace <-@.> - 2011-08-11 12:16 -0700
        Re: servletcontext listener vs servlet with high priority on loading Lew <lewbloch@gmail.com> - 2011-08-11 12:51 -0700
          Re: servletcontext listener vs servlet with high priority on loading "a" <a@mail.com> - 2011-08-11 13:59 -0700

csiph-web