Difference between revisions of "Use org.rifidi.logging"
From RifidiWiki
Line 8: | Line 8: | ||
## Make sure that only one log4J fragment is checked. If more than one is loaded, it is not defined which one will be used to configure log4j. | ## Make sure that only one log4J fragment is checked. If more than one is loaded, it is not defined which one will be used to configure log4j. | ||
## Make sure that <code>org.apache.commons.logging</code> or <code>org.apache.log4j</code> is not being provided by a target platform. It is recommended that target platforms used by rifidi not contain either of these two bundles. | ## Make sure that <code>org.apache.commons.logging</code> or <code>org.apache.log4j</code> is not being provided by a target platform. It is recommended that target platforms used by rifidi not contain either of these two bundles. | ||
+ | Note: Once a Rifidi application is exported teh Edge logging configuration is set in \server\config\logging.properties | ||
+ | |||
+ | Default Configuration (Info and higher (no debug output) | ||
+ | |||
+ | #Default level is INFO to avoid too much output from 3rd Party libraries | ||
+ | log4j.rootLogger=INFO, stdout, fileappender | ||
+ | |||
+ | #Don't care about springframework info statements | ||
+ | log4j.category.org.springframework=warn | ||
+ | #Except for RMI info statements! | ||
+ | log4j.category.org.springframework.remoting=info | ||
+ | |||
+ | #output from apache projects | ||
+ | log4j.category.org.apache.mina=WARN | ||
+ | |||
+ | #Output from LLRP LTK | ||
+ | log4j.category.org.llrp=WARN | ||
+ | |||
+ | #Output from Rifidi Edge Server core | ||
+ | log4j.category.org.rifidi.edge.core.sensors.base.AbstractIPSensorSession=INFO | ||
+ | |||
+ | #log4j.category.org.apache=ALL | ||
+ | #log4j.category.org.apache.commons.digester=INFO | ||
+ | |||
+ | #Set up Console appender | ||
+ | log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
+ | log4j.appender.stdout.Target=System.out | ||
+ | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
+ | log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n | ||
+ | |||
+ | #Set up File Appender | ||
+ | #log4j.appender.fileappender=org.apache.log4j.DailyRollingFileAppender | ||
+ | #log4j.appender.fileappender.File=logs/edge.log | ||
+ | #log4j.appender.fileappender.DatePattern='.'yyyy-MM-dd-HH-mm | ||
+ | #log4j.appender.fileappender.layout=org.apache.log4j.PatternLayout | ||
+ | #log4j.appender.fileappender.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n |
Revision as of 11:24, 18 September 2014
org.rifidi.logging
is a bundle that provides a logging service for other bundles in the rifidi project. Specifically it provides org.apache.commons.logging
and org.apache.log4j
. Log4J relies on a file called log4j.properties
to provide configuration information. The plugin itself does not have a log4j.properties
folder in it. Instead, it relies on a OSGi bundle fragment to add one to the classpath.
To use it in another plugin:
- Make sure that the bundle is checked out in your workspace. You can either download the plugin from the
rep-external
svn repository, or you can use the binary fromorg.rifidi.binary
along with a target platform. - In the Manifest for your plugin, declare a package import of
org.apache.commons.logging
. Make sure that the minimum version is 1.0.4. - In the run configuration:
- Make sure that
org.rifidi.logging
is checked. - Make sure that only one log4J fragment is checked. If more than one is loaded, it is not defined which one will be used to configure log4j.
- Make sure that
org.apache.commons.logging
ororg.apache.log4j
is not being provided by a target platform. It is recommended that target platforms used by rifidi not contain either of these two bundles.
- Make sure that
Note: Once a Rifidi application is exported teh Edge logging configuration is set in \server\config\logging.properties
Default Configuration (Info and higher (no debug output)
- Default level is INFO to avoid too much output from 3rd Party libraries
log4j.rootLogger=INFO, stdout, fileappender
- Don't care about springframework info statements
log4j.category.org.springframework=warn
- Except for RMI info statements!
log4j.category.org.springframework.remoting=info
- output from apache projects
log4j.category.org.apache.mina=WARN
- Output from LLRP LTK
log4j.category.org.llrp=WARN
- Output from Rifidi Edge Server core
log4j.category.org.rifidi.edge.core.sensors.base.AbstractIPSensorSession=INFO
- log4j.category.org.apache=ALL
- log4j.category.org.apache.commons.digester=INFO
- Set up Console appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n
- Set up File Appender
- log4j.appender.fileappender=org.apache.log4j.DailyRollingFileAppender
- log4j.appender.fileappender.File=logs/edge.log
- log4j.appender.fileappender.DatePattern='.'yyyy-MM-dd-HH-mm
- log4j.appender.fileappender.layout=org.apache.log4j.PatternLayout
- log4j.appender.fileappender.layout.ConversionPattern=%d{ABSOLUTE} %5p %c:%L - %m%n