Changing Log4J configuration in Tibco BW/Designer

2019-07-31 14:13发布

问题:

I tried to setup custom Log4J appenders in Tibco BW/Designer.

I added to <tibco_folder>/bw/5.11/lib/log4j.xml the following appender:

<appender name="TestFile" class="org.apache.log4j.FileAppender">
    <param name="file" value="d:/temp/tibco-test.log"/>
    <param name="Threshold" value="DEBUG"/>
    <param name="append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{yyyy MMM dd HH:mm:ss:SSS 'GMT'} %X{offset} %X{engine} %X{role} [%X{msgCategory}] %X{msgcode} %m %n"/>
    </layout>
</appender>

and then I added <appender-ref ref="TestFile"/> to each logger, including bw.logger, beside the tibco_bw_log appender. The messages are sent to tibco_bw_log, but not to my appender.

My appender is getting only some logs like the below, logs that don't appear in tibco_bw_log appender (c:\Users\<me>\.TIBCO\logs\<app_name>.log)

2017 Feb 21 17:05:16:693 GMT    []  no system property set, defaulting to entrust61 since got class com.entrust.toolkit.security.provider.Initializer 
2017 Feb 21 17:05:16:698 GMT    []  getVendor()=entrust61 
2017 Feb 21 17:05:16:719 GMT    []  Initializing Entrust crypto provider in NON FIPS 140-2 mode; insert provider as normal 
2017 Feb 21 17:05:17:302 GMT    []  using X9_31usingDESede 
2017 Feb 21 17:05:18:021 GMT    []  getVendor()=entrust61 
2017 Feb 21 17:05:18:023 GMT    []  Initialized crypto vendor entrust61 
java.lang.Exception: FOR TRACING ONLY -- NOT AN ERROR
at com.tibco.security.impl.new.F.init(CryptoVendor.java:69)
...

Even if I remove the tibco_bw_log appender from bw.logger, the logs are still going there and not to my logger. I changed my appender name to tibco_bw_log and removed the original appender, but then I was getting the error: "org.apache.log4j.FileAppender cannot be cast to com.tibco.share.util.BWLogFileAppender".

Now I don't even get that error, but my appender does not get any logs.

Every time I changed the log4j.xml file, I restarted the Designer. I also applied the same changes to log4j.properties and even removed it. It seems that log4j.xml is taking priority anyway.

I also tried to specify the full path of log4j.xml in bwengine.xml for bw.log4j.configuration and adding the two below properties (as shown here) - no effect.

<property>
       <name>bw.engine.showInput</name>
       <option>bw.log4j.configuration</option>
       <default>true</default>
       <description>Log4j Configuration file path</description>
</property>
<property>
       <name>bw.engine.showOutput</name>
       <option>bw.log4j.configuration</option>
       <default>true</default>
       <description>Log4j Configuration file path</description>
</property>

I'm using BW 5.11 and Designer 5.8.

What am I missing?

回答1:

Unfortunately this is not possible in Tibco. Only Java activities can be used with custom loggers.