【问题标题】:how to send assertions to log file? [duplicate]如何将断言发送到日志文件? [复制]
【发布时间】:2013-09-05 08:44:23
【问题描述】:

我的代码中有断言在我的 ninjatrader 中创建弹出窗口。如何防止弹出窗口并将相同的消息发送到日志文件?

case MarketPosition.Long:
                {
                    Trace.Assert(exitStopOrderLong!= null,"exitStopOrderLong is null");
                    Trace.Assert(exitStopOrderLong.OrderState==OrderState.Accepted,string.Format("exitStopOrderLong is in invalid state{0}",exitStopOrderLong.OrderState));
                    double stopPrice=Instrument.MasterInstrument.Round2TickSize(Low[1]) -Instrument.MasterInstrument.TickSize/2 ;
                    ChangeOrder(exitStopOrderLong, exitStopOrderLong.Quantity, 0, stopPrice);


                    break;
                }

【问题讨论】:

    标签: c#


    【解决方案1】:

    答案要简单得多。添加到 app.config 并放置目标日志文件名。

    http://msdn.microsoft.com/en-us/library/ty5e4c4h.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-02
      相关资源
      最近更新 更多