Enabling Logging

To enable logging in your project in the Alpha group, add these lines to the dependency section of your project POM:

   
       edu.byu.deg
       LogConfiguration
       1.0
       runtime
   

Configuring Logging

To configure logging, open the project LogConfiguration. In NetBeans, go to “Other Sources” and open log4j.xml You can set the logging level for a specific class or package subtree.

Details

This approach is a workaround. It is an improvement over the previous configuration in that it is now possible to edit the log4j.xml file to change the log output. There are still some limitations.

The “right” way is to keep the log4j.xml file separate from the JARs, and put it on the classpath separately at runtime. Log4J takes the first log4j.xml configuration file it finds on the classpath. If there are multiple copies of this file, it is a headache because you don't know which one will be used.

However, Maven likes everything on the classpath to be “Maven-approved”. That's a problem. Eclipse will allow us to add a folder to the classpath, if we manually adjust the settings on each project, but NetBeans didn't allow it at all.

The simple workaround is to encapsulate the configuration file in a JAR.

deg/logging.txt · Last modified: 2015/06/12 10:56 by ryancha
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0