Académique Documents
Professionnel Documents
Culture Documents
STEPS
1. For Each BW Interface, add an entry in the log4j.properties file as mentioned below.
(Path:: <tibco-home>\bw\5.2\lib\log4j.properties)
##SAMPLE
log4j.logger.SAMPLE_Logger=DEBUG, SAMPLE_Logger
log4j.appender.SAMPLE=org.apache.log4j.RollingFileAppender
log4j.appender.SAMPLE.File=/tibco/software/sample.log
log4j.appender.SAMPLE.MaxFileSize=100MB
log4j.appender.SAMPLE.MaxBackupIndex=2
log4j.appender.SAMPLE.layout=org.apache.log4j.PatternLayout
log4j.appender.SAMPLE.layout.ConversionPattern= %-5p %c - %m%n
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 MODIFY
In : String xml
In : int eventSeverity
In : 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;