Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Log() is inaccessible

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Log() is inaccessible

    In 6.5 I would write to the Log if something very unexpected & unwanted was detected by the indicator code. This is not working in NT7. The Log() command is still in the help file, it is not mentioned in the changes PDF, and I did not find any mention in the forum of it changing.

    These error messages are shown when compiling :
    'System.Diagnostics.Log' is inaccessible due to its protection level
    'System.Diagnostics.Log' is a 'type', which is not valid in the given context

    The code is the same as in 6.5:
    Log("message", NinjaTrader.Cbi.LogLevel.Information);

    I tried explicitly referencing System.Diagnostics.Log() but that did not help.
    How do I get it to work in NT7 (Beta 19)?

    #2
    Hello,

    Thank you for your forum post.

    Someone will respond on Monday.

    Thank you for your patience.
    BrettNinjaTrader Product Management

    Comment


      #3
      LostTrader, please try for example Log("Message", LogLevel.Information);

      Comment


        #4
        exact same errors, Bertrand.

        Comment


          #5
          Can you please attach your test script, the command works for me fine in NT7 B19 here. Thanks.

          Comment


            #6
            Now that you say that, I realized that one other indicator already converted from 6.5 also had a log stmt & it was fine. Seems there were two reasons for the errors:

            1. an explicit function call to System.Diagnostics.Log() does not work (??)
            2. the 2nd instance was in a static function, apparently it does not work there at all. :-(

            Bummer, it would be useful if the log & print commands would work in static functions for trace & debug.

            Comment


              #7
              Thanks for those suggestions - perhaps you can send me the indicator where you experience this to support at ninjatrader dot com Attn Bertrand (can strip any custom IP). Thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CaptainJack, 05-29-2026, 05:09 AM
              0 responses
              53 views
              0 likes
              Last Post CaptainJack  
              Started by CaptainJack, 05-29-2026, 12:02 AM
              0 responses
              34 views
              0 likes
              Last Post CaptainJack  
              Started by charlesugo_1, 05-26-2026, 05:03 PM
              0 responses
              100 views
              0 likes
              Last Post charlesugo_1  
              Started by DannyP96, 05-18-2026, 02:38 PM
              1 response
              180 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 05-11-2026, 05:56 AM
              0 responses
              170 views
              0 likes
              Last Post CarlTrading  
              Working...
              X