From: Erik V. <eri...@hc...> - 2007-01-11 19:51:00
|
I'm considering to add log4j logging, to move (or duplicate) the current console messages to a log file. (This will not affect the Log Window, which is actually a misnomer for a Game Report window). Any objections? Remain two questions: - 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. - what configuration file? Default is log4j.properties, but I am considering to include the log4j properties in a common properties file. This would require setting a system property on the command line (if possible with a default in the main() method). One additional item I would like to include in such a file would be a choice for the type of tile picture to use: GIF or SVG. Today I worked on another PC where the SVG's were not loaded yet, and it struck me again how much better the GIFs looked. So I would like to be able to set that as a preference. Any comments? Erik Vos |
From: Brett L. <wak...@gm...> - 2007-01-12 01:20:16
|
On Thu, 2007-01-11 at 20:50 +0100, Erik Vos wrote: > I'm considering to add log4j logging, to move > (or duplicate) the current console messages to > a log file. (This will not affect the Log Window, > which is actually a misnomer for a Game Report window). > > Any objections? > None. I like log files. They're good for bug reports. ;-) > Remain two questions: > > - 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. > - what configuration file? > Default is log4j.properties, but I am considering to > include the log4j properties in a common properties file. > This would require setting a system property on the command line > (if possible with a default in the main() method). > We definitely need our own configuration file, as we've discussed before. I think it's reasonable to expose a small subset of log4j settings in our configuration file. Typical settings would be things like to enable/disable logging to a file, logging verbosity, maximum log file size, etc. > One additional item I would like to include in such a file > would be a choice for the type of tile picture to use: > GIF or SVG. Today I worked on another PC where the SVG's > were not loaded yet, and it struck me again how much better > the GIFs looked. So I would like to be able to set that > as a preference. > That's fine. The SVG code needs fixing. Right now, we're not really leveraging the library as well as we could. ---Brett. |
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. |
From: brett l. <wak...@gm...> - 2007-01-12 20:21:36
|
On 1/12/07, Erik Vos <eri...@hc...> wrote: > > 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. > Ah ha... That makes sense. I agree, i'm not sure we need much more granularity. Package-level loggers sounds appropriate to me. ---Brett. |