You have asked whether a judge who has been subpoenaed to testify
as a character witness may, if given the opportunity, submit an
affidavit in lieu of live testimony. You note the applicability of
Canon 2B which states in part that "[A] judge shall not testify
voluntarily as a character witness."

The commentary to Canon 2B makes it clear that while judges may be
called on to testify in the interests of justice, a judge should
discourage a party from requiring the judge to testify as a character
witness. The commentary reads in part:

A judge must not testify voluntarily as a character witness
because to do so may lend the prestige of the judicial office in
support of the party for whom the judge testifies. Moreover, when a
judge testifies as a witness, a lawyer who regularly appears before
the judge may be placed in the awkward position of cross-examining
the judge. A judge may, however, testify when properly summoned.
Except in unusual circumstances where the demands of justice
require, a judge should discourage a party from requiring the judge
to testify as a character witness.

Your letter tells us nothing concerning the case or the mechanics
of the affidavit, i.e., who is to prepare it or whether it is to be in
question and answer form, etc. If it is contemplated that you are
simply to compose a verified statement relative to the character or
reputation of the litigant, it would, we believe, be little different
from your writing a letter of recommendation and could impinge
on the constraints of Canon 2B, notwithstanding the subpoena. In the
absence of exceptional circumstances, we believe the preferred course
in conformity with Canon 2B where a judge is compelled to testify as a
character witness is for such testimony to be given verbally in the
presence of the jury or fact-finder.