Differences

This shows you the differences between two versions of the page.

Link to this comparison view

deg:logging [2015/06/12 16:56] (current)
ryancha created
Line 1: Line 1:
 +=== Enabling Logging ===
 +To enable logging in your project in the Alpha group, add these lines to the dependency section of your project POM:
 +
 +    <​dependency>​
 +        <​groupId>​edu.byu.deg</​groupId>​
 +        <​artifactId>​LogConfiguration</​artifactId>​
 +        <​version>​1.0</​version>​
 +        <​scope>​runtime</​scope>​
 +    </​dependency>​
 +
 +=== 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 16: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