N
Novice
I _think_ these supplementary questions will be a lot less of a struggle
than the others in "Aspect questions" thread. That thread is getting on
the long side so I thought I'd ask these in a new thread.
Basically, I'm looking for advice on what should always be logged by
every class. I understand now that every class is going to have its own
logger but what should be logged?
Or to put it another way, are there cases where a class won't log at all?
I'm thinking of things like Enums. If I have an enum that lists the days
of the week, there's not much to go wrong there and I'm not likely to
throw exceptions or even have a try/catch block. So should it just be
left so that it isn't logging at all? Or should there be some standard
bare-minimum sort of logging, like an entering() and existing(), even if
nothing else of interest goes on?
What about holder classes? I'm not sure if I'm using the terminology
correctly but I'm thinking of a class where you simply store related bits
of data, like a Name class whose constructor insists on a first name and
a last name and then supplies getters and setters so that another class
can ask for just the first name or just the last name? (Let's pretend
that everyone has exactly one given name and one surname, no exceptions,
just to keep this simple). This could be an awfully barebones class if it
only had a two line constructor and one line getters and setters. Should
it log anyway?
My feeling is that Lew would say NOT to log unless there was a good
reason to log and then cite several good reasons to log. I'm not sure if
something like an enum or a holder class (if I've used the term
correctly) would EVER justify logging though.
I may have completely misread Lew and, if so, I'm sorry. Maybe this is
another premature leap....
Some of the rest of you may differ dramatically on what should be logged
and when it is okay not to bother. I hope some of you can share those
thoughts with me.
Basically, I'm just about ready to start getting loggers for each and
every class in the project I'm working on now (with plans to do the same
in every project as I create it or return to it). But I don't want to do
too much logging either.....
than the others in "Aspect questions" thread. That thread is getting on
the long side so I thought I'd ask these in a new thread.
Basically, I'm looking for advice on what should always be logged by
every class. I understand now that every class is going to have its own
logger but what should be logged?
Or to put it another way, are there cases where a class won't log at all?
I'm thinking of things like Enums. If I have an enum that lists the days
of the week, there's not much to go wrong there and I'm not likely to
throw exceptions or even have a try/catch block. So should it just be
left so that it isn't logging at all? Or should there be some standard
bare-minimum sort of logging, like an entering() and existing(), even if
nothing else of interest goes on?
What about holder classes? I'm not sure if I'm using the terminology
correctly but I'm thinking of a class where you simply store related bits
of data, like a Name class whose constructor insists on a first name and
a last name and then supplies getters and setters so that another class
can ask for just the first name or just the last name? (Let's pretend
that everyone has exactly one given name and one surname, no exceptions,
just to keep this simple). This could be an awfully barebones class if it
only had a two line constructor and one line getters and setters. Should
it log anyway?
My feeling is that Lew would say NOT to log unless there was a good
reason to log and then cite several good reasons to log. I'm not sure if
something like an enum or a holder class (if I've used the term
correctly) would EVER justify logging though.
I may have completely misread Lew and, if so, I'm sorry. Maybe this is
another premature leap....
Some of the rest of you may differ dramatically on what should be logged
and when it is okay not to bother. I hope some of you can share those
thoughts with me.
Basically, I'm just about ready to start getting loggers for each and
every class in the project I'm working on now (with plans to do the same
in every project as I create it or return to it). But I don't want to do
too much logging either.....