-
Notifications
You must be signed in to change notification settings - Fork 1
Logging Usage
For logging purposes Red Deer uses Apache Log4J library.
Here are instructions for common usage of logging within Red Deer project:
-
Add org.apache.log4j plugin to Red Deer plugin dependencies within MANIFEST.MF file of Red Deer plugin where logging is needed.
-
Add this line to the same MANIFEST.MF file
Eclipse-RegisterBuddy: org.apache.log4j -
Add Log4J configuration file named log4j.xml to src subdirectory of Red Deer plugin. Example of simple log4j.xml can be found here.
-
Insert creating of Logger instance into the class where logging is going to be used. Define Logger instance as
privateorprotectedand use enclosing class orthis.getClass()as parameter for methodLogger.getLogger(<class>)e.g.protected final Logger log = Logger.getLogger(this.getClass()); -
Use methods of Log instance as appropriate.
To override default configuration stored within plugin do this:
-
Create custom log4 configuration file with required setting
-
Use system property
log4j.configurationwith proper format to specify location of custom log4 configuration file when running tests e.g.
add -D-Dxxxlog4j.configuration=file:/home/reddeertest/custom.xml to Run Configuration > Arguments > VM arguments when running directly from Eclipse IDE.
To check if proper configuration file is used do this:
- specify system property
log4j.debug. When used Log4J will log his own settings to console. To set this property when running tests from Eclipse IDE do this:
add -Dlog4j.debug to Run Configuration > Arguments > VM arguments when running directly from Eclipse IDE.
JBoss Red Deer - Quick Links
- Home
- [Release notes] (/jboss-reddeer/reddeer/wiki/Release-notes)
- Articles
- JavaDoc
- User guide
- Contributor Guide
- FAQ