On 8/30/06, Andrew Zhang wrote:
On 8/30/06, Stepan Mishura wrote: > > On 8/30/06, Andrew Zhang wrote: > > > On 8/30/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > > I was browsing thought logging tests and realized that running logging > > > test > > > suite cause updates of tested JRE configuration. > > > The ant script changes jre/lib/logging.properties file by: > > > > > > <target name="copy.resources"> > > > <copy todir="${hy.jdk}/jre/lib" overwrite="yes" flatten="yes"> > > > <fileset dir="${hy.logging.src.main.java}"> > > > <include name="**/logging.properties" /> > > > </fileset> > > > </copy> > > > </target> > > > > > > I do believe that we shouldn't do testing in this way - if a test > > requires > > > special env. configuration(different from JRE's default) the test > suite > > > shouldn't *hack* JRE config files. We should consider dynamic env. > > > reconfiguration. For example, for this particular case is there any > > > problem > > > with using LogManager.readConfiguration(InputStream) to reinitialize > the > > > logging properties? > > > > > > Yes, they're different. :-) Static first initialization acts differently > > from readConfiguration if you take a look at the source code. :) > > > Could you describe in few words what is the difference?The static initialization block looks different from readConfigure(), doesn't it? :-)
Hi Andrew, I've just looked into static initialization block and then to the spec. for LogManager class. My impression is that Harmony implementation doesn't follow the spec. The spec. says: "At startup the LogManager class is located using the ' java.util.logging.manager' system property.By default, the LogManager reads its initial configuration from a properties file "lib/logging.properties" in the JRE directory...." So if the property 'java.util.logging.manager' is not set a default implementation is used. The default implementation looks for ' java.util.logging.config.class' and 'java.util.logging.config.file' system properties, reads config from 'jre/lib/logging.properties' and so on. If the mentioned property is set then a custom LogManager class implementation is used. And it is up to the custom implementation how to load configuration. Right? But Harmony implementation follows default initialization procedure in any case. It loads the custom LogManager, looks for ' java.util.logging.config.class' and 'java.util.logging.config.file' system properties and if none of them are set and it forces the custom LogManager to read properties from 'jre/lib/logging.properties' file. Why? It is up to the custom implementation whether to read it or not. Did I missed something? Thanks, Stepan. <SNIP> ------------------------------------------------------ Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
