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や他のロギングフレームワークへの依存関係を含んでいませんが、メッセージを渡したり自分で処理したりするための仕組みを提供しています。これは、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.
}
};
