On Dec 12, 2:50 pm, "a.maza" <andr.m...@gmail.com> wrote: > Hello, > > I have currently some troubles with logging in junit tests. In > general, I have the following questions: > > -) According to the manuals, I could basically use any log framework > which logs to System.out and System.err, respectively (e.g., log4j). > However, for having a fine grained selection mechanism in the admin > console, the use of java.util.logging (JUL) is required. Is this true, > since the log levels of the admin console remind me rather to those of > log4j than those of JUL. > > -) JUL logging works quite fine for running the web application on > jetty. However, when doing junit tests, JUL does not automatically > read the logging.properties from the file system resulting in logging > INFO and above. > I have learned that the logging.properties file can be set using the - > Djava.util.logging.config.file jvm argument. However, doing this for > every junit test is a little bit cumbersome. (i.e., not an option). > Some websites state that setting a system property > (java.util.logging.config.file) in the base test class may work - but > not in my case. > JUL would allow to read a logging.properties file from the filesystem > using the LogManager class. However, the LogManager is a restricted > class on GAE (also in the dev environment). > > I also thought about the option of using SLF4J with the JUL binding > for the web application and SLF4J with a log4j binding for JUnit > tests... but I am not sure if this works out....
Since SLF4J is just a facade it doesn't support any configuration. > I would be happy to hear from others how they manage logging > (especially in JUnit tests) or any suggestions that might help... I don't use JUL if I have a choice. With logback you can just add a logback-test.xml to src/test/resources and you're set. For JUL configuring argLine in the surefire plugin might be an option. You could also put a MethodRule or some setup method an abstract super class for all tests that set up JUL. Cheers Philippe -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.