ログ メッセージをファイルにフォーマットするためのカスタム ファイル ハンドラを指定する loggers.config ファイルがあります。指定されたファイル パターンでデフォルト ファイルを作成しない限り、ハンドラーは機能しません。次に、パターンで指定されたとおりに 0 が追加された新しいファイルを作成し、そのファイルへのログ記録を開始します。最初にデフォルトのファイルを指定せずにファイルにログを記録するにはどうすればよいですか。
ログファイルは次のとおりです。
handlers=com.daniel.logging.MyFileHandler
# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overriden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= INFO
com.daniel.logging.MyFileHandler.level=INFO
# Naming style for the output file:
com.daniel.logging.MyFileHandler.pattern=daniel%g.log
# Limiting size of output file in bytes -defaulted to 1MB:
com.daniel.logging.MyFileHandler.limit=1MB
# Number of output files to cycle through, by appending an
# integer to the base file name:
com.daniel.logging.MyFileHandler.count=10
# Style of output (Simple or XML):
com.daniel.logging.MyFileHandler.formatter=com.daniel.logging.MyLogFormatter
# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
インストーラー (これはアプリケーション ログのプロパティ ファイルです。作成されたファイルがあり、logger.config ファイルを logger.properties として指定する行があります。数行後にファイルが作成され、コマンド CMD [@] >> default_file 2>&1. その行が何をするのかわかりません (私は bash にまったく慣れていません)