Upload
rameshch
View
217
Download
3
Embed Size (px)
DESCRIPTION
using logging in tibco and common framwork
Citation preview
Log4j for logging the Data in Java Palletes of BWs.
STEPS
1. For Each BW Interface, add an entry in the log4j.properties file as mentioned below. (Path:: \bw\5.2\lib\log4j.properties)
##SAMPLE
log4j.logger.SAMPLE_Logger=DEBUG, SAMPLE_Loggerlog4j.appender.SAMPLE=org.apache.log4j.RollingFileAppenderlog4j.appender.SAMPLE.File=/tibco/software/sample.loglog4j.appender.SAMPLE.MaxFileSize=100MBlog4j.appender.SAMPLE.MaxBackupIndex=2log4j.appender.SAMPLE.layout=org.apache.log4j.PatternLayoutlog4j.appender.SAMPLE.layout.ConversionPattern= %-5p %c - %m%n
2. Set the content Job Shared variable which need to log.
3. In the Java Pallete, Instantiate the Logger Object first and then use the required level of logging methods to log the data into the above mentioned log file. LoggerName shall be the Global Variable containing the name of the logger given in the properties file.For the above case it is SAMPLE
JAVA CODE:
/* Available Variables: DO NOT MODIFYIn : String xmlIn : int eventSeverityIn : String LoggerName* Available Variables: DO NOT MODIFY *****/org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(LoggerName); String xml = getxml();switch (geteventSeverity()) {
case 0: logger.debug(xml); break;case 1: logger.info(xml); break;case 2: logger.error(xml);break;case 3: logger.warn(xml);break;case 4: logger.fatal(xml);break; default:break;}