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


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

Re: servletcontext listener vs servlet with high priority on loading

From "a" <a@mail.com>
Newsgroups comp.lang.java.programmer
Subject Re: servletcontext listener vs servlet with high priority on loading
Date 2011-08-11 13:59 -0700
Organization Netfront http://www.netfront.net/
Message-ID <j21fsc$1rmf$1@adenine.netfront.net> (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> <35db14aa-dcbd-44ab-86eb-2b3695a58bf3@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


"Lew" <lewbloch@gmail.com> wrote in message 
news:35db14aa-dcbd-44ab-86eb-2b3695a58bf3@glegroupsg2000goo.googlegroups.com...
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

Hi Lew,

Thank you very much.
I will review the problem for my static logger.
Can you please explain my first question?
Besides, it is made for the job, why servlet context listener is better than 
using servlet with high load priority?

Thanks 



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

Back to comp.lang.java.programmer | Previous | NextPrevious 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