aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Help with Log Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Help with Log" Watch "Help with Log" New topic
Author

Help with Log

Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi ranchers

I need some help and tips with how to log my assignment....so here we go :
1. I need log every method ?
2. Or just publics ones ?
3. Do I need log private methods that are called by public log ones inside the class ?
4. Do I need log get's and set's mehods ? Why ? It dont make sense ?
5. There are some right patter ? how ? I saw DVD Monkhouse simple like:

public void doSomenthing(params...) {
log.entering("ClassName", "ClassMethod", params...);
//executing somenthing
//log.info("informations stuf");
//log.warning("dangerous stuff");
log.exiting("ClassName", "ClassMethod");
}




Fernando Franzini - Java Blog
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2409
    
    7

Hi Fernando, the question to ask yourself is do you need the logging feature in your assignment?
I see logging can be helpful to determine why such function throw exceptions especially on the server side. On the other hand, depend on what you do with your logging, how do you determine the exception's severity - prompt to the client, ignore it, shutdown server etc?

Some people that used logging in the beginning of the assignment do in fact end up taking it out for final submission. Again some people keep it to reduce messing up what they already have. There is a logging API in the Java API, you may want to look at it. Remember for the SCJD the key is to keep it simple, make sure everything works as expected especially locking.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi K.

I really dont like Log...but i'm aware about benefits. Anyway,......I've read that I can lose some general point....so....why not put it ?? lollll ....I've read here that there were some people that passed without any log...
I dont know much about log...so if someone could take me some tips.....
Regards...
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2409
    
    7

Fernando Franzini wrote:I really dont like Log...but i'm aware about benefits. Anyway,......I've read that I can lose some general point....so....why not put it ?? lollll ....I've read here that there were some people that passed without any log...
I dont know much about log...so if someone could take me some tips.....


If 1) you don't like log and 2) the assignment doesn't "require" logging, then why are you still considering the logging feature. Beside getting say logging to work just for the sake of logging may delay your progress of the assignment. Why you consider focusing on the real issues like the network server, locking, and Data class.

And depending on where you are, logging feature can just make or break your application.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5266
    
  13

Hi Fernando,

At first I decided not to use logging feature (because it is not required by assignment) and used sysouts to print parameters and return values, giving me some debug information during the development process. My intention was to delete these sysouts before submitting, but at last I decided to just use the logging-feature.

I turned the logging completely off when submitted the assignment and argued in my choices.txt that the logging could be easily turned back on giving valuable debug information when some changes are made or new functionalities are added to the program

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Roel De Nijs wrote:I turned the logging completely off when submitted the assignment and argued in my choices.txt that the logging could be easily turned back on giving valuable debug information when some changes are made or new functionalities are added to the program


Good call!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with Log