This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Java in General and the fly likes Unable to log .. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unable to log .." Watch "Unable to log .." New topic

Unable to log ..

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Hey all.
I have the following code :

the problem is the logging is not working inside the constructor
(I mean, "server Object is created" is not been logged , while the
logging statement in the other methods of class Server is logged).
any ideas ?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
I'm not sure about this one. logger may not really exist until the constructor finishes. (Usually we make class-level loggers a static variable.) If you really need it to be instance, just move the initialization into your constructor and then you should be fine. If you make it static, it will work as you currently expect.

I agree. Here's the link:
subject: Unable to log ..
It's not a secret anymore!