Skip to main content
Interwork Corporation
IDR Solutions Product Support Portal
モードの切替 ダーク/ライト/自動 モードの切替 ダーク/ライト/自動 モードの切替 ダーク/ライト/自動

JPedalのログファイルとログ活動を取得する方法

これはJPedalを使用するアプリケーションに以下のコード行を追加することで実現できます。

//Output log information to console
LogWriter.setupLogFile("v");

//Specify file to store log information added to console
LogWriter.log_name =  "log.txt";

JPedalはLoggerやその他のLoggingフレームワークへの依存関係を含んでいませんが、メッセージを受け渡したり、自分で処理したりするための仕組みを提供しています。LogWriterにLogScannerを追加することで実現できます。

これは、特定のエラーメッセージに対してポップアップダイアログを追加したり、異なるタイプのメッセージに対してカスタム機能を実装したりするなど、カスタム機能の実装に使用できます。

//Specify file to store log information added to console
LogWriter.logScanner = message -> {
    if (message != null && message.startsWith("[MEMORY]")) {
        //Implement you own custom functionality for this message
        //Or call Logger. or other logging framework.
    }
};