[Engine-devel] [backend] logger declarations

Hi, In general loggers are recommended to be private static final, also have the correct class. (e.g. commons logging standards from PMD http://pmd.sourceforge.net/rules/logging-jakarta-commons.html) In oVirt backend, very often the logger is just package protected, which allows classes in the same package to use it. Actually the classes that really use it are usualy subclasses, but what I believe is misleading in this case is that when reading a log, you will see that e.g. org.foo.Bar logged 'X', and you look into the sourcecode of org.foo.Bar and you do not see any code that would ever log that message, you will have to look for that message in all of it's subclasses and this will make debugging harder especially if the number of subclasses is high. I am trying to maintain a coding standard here, please feel free to edit: http://www.ovirt.org/wiki/Backend_Coding_Standards Thank you, Laszlo

Hi,
In general loggers are recommended to be private static final, also have the correct class. (e.g. commons logging standards from PMD http://pmd.sourceforge.net/rules/logging-jakarta-commons.html)
In oVirt backend, very often the logger is just package protected, which allows classes in the same package to use it. Actually the classes that really use it are usualy subclasses, but what I believe is misleading in this case is that when reading a log, you will see that e.g. org.foo.Bar logged 'X', and you look into the sourcecode of org.foo.Bar and you do not see any code that would ever log that message, you will have to look for that message in all of it's subclasses and this will make debugging harder especially if the number of subclasses is high.
You are talking about category, but since our command inherit from each other then I think it's more useful to have the category determined by the actual runtime class - this way you can control the log verbosity of a specific command/flow. However, I think this is not our biggest problem, but that the logging itself is not very good overall and it is sometimes hard to track down what causes the issues because of that.
I am trying to maintain a coding standard here, please feel free to edit: http://www.ovirt.org/wiki/Backend_Coding_Standards
Thank you, Laszlo
participants (2)
-
Laszlo Hornyak
-
Mike Kolesnik