candlepin/candlepin — pull request #255 by jmrodri (2013-05-15 12:55:44+00:00)
Title: get javascript logging working with buildr

We've had a series of folks wanting to log from the rules.js file.
Making changes to log4j.properties has proved to be useless. I added
-Dlog4j.debug to the jvm_args for testing to see what was going on
and it turns out log4j was picking up the log4j.properties from:
**GUICE-PERSIST!!!!**

There's a bug for that already:

https://code.google.com/p/google-guice/issues/detail?id=623

This does not affect the application because we forcibly configure
log4j in LoggingConfig.java.

No matter what we do, buildr test will never pick up our log4j.properties.
I tried putting target/resources and target/classes at the front of
the test.with classpath but that caused other problems, like causing
Hibernate not to find any of the model classes.

log4j will first look for a log4j.xml file in the classpath, if not found
then looks for a log4j.properties file. I investigated using a log4j.xml
file but it was quite ugly and difficult to use compared to the properties
file. The alternative was to specify the properties file to use as a
jvm_arg. So I added a new log4j-test.properties to src/test/resources
and defined it in the buildfile in the jvm_arg.

In order to see debug logging from javascript rules add this
to the new log4j-test.properties:

```
log4j.logger.org.candlepin.policy.js=DEBUG
```