Results 1 to 5 of 5

Thread: Logger

  1. #1
    Dipke is offline Member
    Join Date
    Aug 2010
    Location
    Leuven, Belgium
    Posts
    86
    Rep Power
    0

    Default Logger

    Hi,

    I have a program that uses a static logger :

    Java Code:
    private static final Logger logger =
            Logger.getLogger(Log.class.getName());
    When i let Netbeans inspect the program, the only remark i get is that i have to create a logger field in each class.
    Why netbeans propose this ?

    Kind regards
    Dipke

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,018
    Blog Entries
    7
    Rep Power
    23

    Default Re: Logger

    Quote Originally Posted by Dipke View Post
    Hi,

    I have a program that uses a static logger :

    Java Code:
    private static final Logger logger =
            Logger.getLogger(Log.class.getName());
    When i let Netbeans inspect the program, the only remark i get is that i have to create a logger field in each class.
    Why netbeans propose this ?

    Kind regards
    Dipke
    If you take that line out of your class, Netbeans stops whining? If so, forget that warning when you put the line in ...

    kind regards,

    Jos
    I have the stamina of a seal; I lie on the beach instead of running on it.

  3. #3
    Dipke is offline Member
    Join Date
    Aug 2010
    Location
    Leuven, Belgium
    Posts
    86
    Rep Power
    0

    Default Re: Logger

    Hi,

    Thanks for the answer.
    I know that netbeans stops winning, but why i have (according to netbeans) to put this line in each class ?
    Is there any particulary reason ?

    The logger just works fine.

    Kind regards
    Dipke

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,018
    Blog Entries
    7
    Rep Power
    23

    Default Re: Logger

    Quote Originally Posted by Dipke View Post
    I know that netbeans stops winning, but why i have (according to netbeans) to put this line in each class ?
    Is there any particulary reason ?
    I think Netbeans is being too itchy and expects all classes to have a Logger when one class has one. Computers and semantics are a bad combination ;-)

    kind regards,

    Jos
    I have the stamina of a seal; I lie on the beach instead of running on it.

  5. #5
    Dipke is offline Member
    Join Date
    Aug 2010
    Location
    Leuven, Belgium
    Posts
    86
    Rep Power
    0

    Default Re: Logger

    Hi Jos,

    Many thanks for the explanation

    Kind regards
    Dipke

Similar Threads

  1. Log4j Logger question
    By jakSun8 in forum New To Java
    Replies: 4
    Last Post: 03-24-2012, 09:41 PM
  2. How to create a instance for logger?
    By nirasiva in forum New To Java
    Replies: 3
    Last Post: 06-04-2011, 08:43 AM
  3. Logger Usage Inquiry
    By Turyturbo in forum Advanced Java
    Replies: 5
    Last Post: 03-24-2011, 05:31 PM
  4. A better Java logger
    By tony-walker in forum Reviews / Advertising
    Replies: 0
    Last Post: 09-09-2010, 01:32 PM
  5. Help with key Logger in java
    By paul in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 05:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •