Common.Logging を使用するライブラリがあります。ログへの書き込みが発生したときにコードを呼び出す必要があります。
3 に答える
何も変更したくない場合は、AOP を使用して Common.Logging へのメソッド呼び出しをインターセプトできますが、実行時にコードを挿入する舞台裏で AOP が多くのオーバーヘッドを追加することに注意してください。 Common.Loggin を作成し、実行したいコードを指すデリゲートを呼び出す独自の Write メソッドを作成します (一種のコールバック)
if your logging has been designed to an interface, you can use Decorator pattern to create new Logging which will internally call the original Logging.
And then you can register your new DecoratorLogging against ILogging (via dependency injection) that you have so that any consumers of the ILogging will not know that they are actually using your new logger :)
自分のアダプターを LogManager.Adapter に設定すると、問題なく動作しました。