extend org.apache.log4j.PatternLayout

 

The following files are checked in to xxx(cvs head) to enhance the server logging. Please update and let me know if you have any questions.

 

1 new file:

                com.xxx.fmk.util.ScctServerPatternLayout

 public class ScctServerPatternLayout extends PatternLayout {
 public String format(LoggingEvent event) {
  return ScctProperties.getLogId() + " " + super.format(event);
 }
}

3 changed files:

                com.xxx.scct.util.ScctProperties

                com.xxxp.scct.calypsoadapter.CalypsoAdapter

               

                config/log4j.properties

 

With the above changes, you will see user session ID before all log messages from your server log file. This can help you quickly identify a user/user session in a multi-user environment.

In certain messages, you will see "unnamed" or "untitled". It means at those points, we can not determine who the current user is.

 

Example:

 

logs before the change:

                11/29/2011 16:16:18, 522 [MessageHandlerThread-17] [ INFO] LiquidationEngineDAO :[101] - {call pkg_position.getposnforposnview(?,?,?)}

                11/29/2011 16:16:18, 522 [MessageHandlerThread-17] [ INFO] LiquidationEngineDAO :[102] - false

                11/29/2011 16:16:20, 772 [MessageHandlerThread-17] [ INFO] AdapterUserSession :[1120] - positionDataList size: 1303

                11/29/2011 16:16:20, 835 [MessageHandlerThread-17] [ INFO] PortfolioPositionViewConverter :[190] - Populated Portfolio Position Details

                11/29/2011 16:16:20, 851 [MessageHandlerThread-17] [ INFO] PortfolioPositionViewConverter :[194] - Calculated Position Summary Data

logs after the change:

                ym07378_-8588790108660922597 11/29/2011 16:16:18, 522 [MessageHandlerThread-17] [ INFO] LiquidationEngineDAO :[101] - {call pkg_position.getposnforposnview(?,?,?)}

                ym07378_-8588790108660922597 11/29/2011 16:16:18, 522 [MessageHandlerThread-17] [ INFO] LiquidationEngineDAO :[102] - false

                ym07378_-8588790108660922597 11/29/2011 16:16:20, 772 [MessageHandlerThread-17] [ INFO] AdapterUserSession :[1120] - positionDataList size: 1303

                ym07378_-8588790108660922597 11/29/2011 16:16:20, 835 [MessageHandlerThread-17] [ INFO] PortfolioPositionViewConverter :[190] - Populated Portfolio Position Details

                ym07378_-8588790108660922597 11/29/2011 16:16:20, 851 [MessageHandlerThread-17] [ INFO] PortfolioPositionViewConverter :[194] - Calculated Position Summary Data

 

to disable this feature, change the config/log4j.properties file as follows:

 

................ hide the new layout, show the old one

                                log4j.appender.A1.layout=org.apache.log4j.PatternLayout

                                # log4j.appender.A1.layout=com.xxx.fmk.util.ScctServerPatternLayout

                               

                                .....

                               

                                log4j.appender.A2.layout=org.apache.log4j.PatternLayout

                                # log4j.appender.A2.layout=com.xxx.fmk.util.ScctServerPatternLayout

................

 

The above change only works for actions originated from CalypsoAdapter.handleBrokerMessage, which covers all interactions between Apollo Client and server. Obviously we have messages from other sources. If you like these new log messages, we can enhance those other areas in the future.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值