J
John
I have been looking at log4r for a project that involves a
multithreaded web application.
The log4r docs recommend one logger per class. Does that mean in each
class I have to create a @log variable to hold a reference to the
logger? Can't I just have a $log variable, or will multiple threads
collide?
I really like the look of the local log statement,
log.warn "Oh, no!"
but it looks like I'll have to use @log.warn or $log.warn.
And that reminds me of a thread question. Are mutexes needed only for
writing? In other words, if I have a hit counter that's being
incremented, @hits, and the only thing changing the value is one
method in the class in which @hits lives, is it OK to have a show_hits
method that returns @hits or does it have to be mutexed?
multithreaded web application.
The log4r docs recommend one logger per class. Does that mean in each
class I have to create a @log variable to hold a reference to the
logger? Can't I just have a $log variable, or will multiple threads
collide?
I really like the look of the local log statement,
log.warn "Oh, no!"
but it looks like I'll have to use @log.warn or $log.warn.
And that reminds me of a thread question. Are mutexes needed only for
writing? In other words, if I have a hit counter that's being
incremented, @hits, and the only thing changing the value is one
method in the class in which @hits lives, is it OK to have a show_hits
method that returns @hits or does it have to be mutexed?