views:

35

answers:

1

I have DN 2.x on Eclipse RCP (currently Helios).

I'm having trouble Turning the DN LOG on.

I use log4j.properties, where i define all the DataNucleus Categories LOG levels.

It LOGS fine with the "external" enhancer (i just pass the argument on the "VM Arguments" of the RUN configurations -Dlog4j.configuration=file:"...\log4j.properties"), but can't get the log to work on the main app... tried the same approach with no success.

Anyone using DN with eclipse?

A: 

I don't use DN. So I can't address your problem, directly. I can say, in general, if you have an application using Log4j, it will search the classpath for files named log4j.properties and log4j.xml. In your case, try moving your log4j.properties file to a place you are 100% certain is in the classpath (like the root folder of all your packages).

From there, if your logging turns on, then you know your properties file isn't in the classpath. However, if your file is definitely in the classpath, then the culprit is likely something else turning off logging application-wide. Do you see logging at all? If not, then this is likely the problem. At that point you need to figure out which Facade you're using: apache commons or SLF4J. Both have the power to replace the logger implementation with NOOP loggers, which ignore all log requests.

With Commons, you have to check the commons-logging.properties file. With SLF4J, you have to check the project dependencies (usually in a lib directory somewhere), insuring that there isn't a NO-OP jar in the list.

gmale
I have the log4j.properties on the root of the project, and it's on the classpath. I use Apache log4j-1.2.16.jar. I can't find any specific config (like commons-logging.properties), or any NO-OP jar :-\ Tried everything i could think of.
marcolopes
@marcolopes: have you tried putting your logger into debug mode (by passing `-Dlog4j.debug` as a VM argument)? This will print out information about which property file log4j is using to configure itself. If it's using YOUR property file, as expected, then the only other culprit is the actual implementation of Logger. Meaning, when that dependency is being injected, the class used to actually carry out the Logging is probably ignoring all log requests.
gmale
I've tried every suggestion but could not even make the DEBUG mode work. i am sure -Dlog4j.debug is on the arguments of the project Product file... this is driving me crazy! Where is the VM Log file located?
marcolopes
@marcolopes: when I add that command as in `java -Dlog4j.debug -cp classpath etc...` then the log4j debug information prints to the console. If I add the command in Eclipse, as in `Run > Run Configurations... > Arguments Tab > VM Arguments > (enter -Dlog4j.debug) in the box`, then it shows up in the console view. On our tomcat server, it shows up under `/tomcat/logs/catalina.out`. I'm not sure where it would be on your system but it will go to the same place all System.out.println calls go.
gmale