Section 121 of The Indian Evidence Act, 1872
121. Judges and Magistrates.—No Judge or Magistrate shall, except upon the special order of some Court to which he is subordinate, be compelled to answer any question as to his own conduct in Court as such Judge or Magistrate, or as to anything which came to his knowledge in Court as such Judge or Magistrate; but he may be examined as to other matters which occurred in his presence whilst he was so acting. Illustrations
(a) A, on his trial before the Court of Sessions, says that a deposition was improperly taken by B, the Magistrate. B cannot be compelled to answer questions as to this, except upon the special order of a superior Court.
(b) A is accused before the Court of Sessions of having given false evidence before B, a Magistrate. B cannot be asked what A said, except upon the special order of the superior Court.
(c) A is accused before the Court of Sessions of attempting to murder a police officer whilst on his trial before B, a Sessions Judge. B may be examined as to what occurred.