From: Erik V. <eri...@hc...> - 2007-01-12 19:03:11
|
> > > > - how many loggers to create? > > Perhaps simplest is one in the top of each class hierarchy. > > One per package might be another approach, but then we would > > need some central class with a protected static logger > > for easy access by any class in each package. > > > > > I'm not very familiar with how loggers translate to log files. I don't > think we need more than one log file just yet. So, probably a single > static log class that's accessible by everyone most closely duplicates > what we currently do. Loggers (in the log4j sense) do not relate to different log files, but to the granularity with which log levels can be set to different values for different parts of the code. For instance, if we would define a logger for each package, we could set the log level to DEBUG for the ui package whilst leaving the level at INFO for the game package, if we are debugging a particular UI problem. In other projects I have often defined a separate logger for each class (or class hierarchy). But in reality I have never used that ultimate flexibity to set different log levels; in fact I've only changed the top level, which applies to all loggers. So I think we can best set loggers at the package level. I have already experimented with that and it works fine. Later I'll check in some code using that. Erik. |