java.util.logging のプロパティ ファイルを使用し、パッケージの下のすべてのクラスをログに記録したい:
aaa.bbb.ccc.*
通常の方法 (つまり、info、fine、finer) ですが、class
aaa.bbb.ccc.ddd.MyClass
独自のログ ファイル「My Class.log」で、レベルを細かく設定します。
構成は、プロパティ ファイルを介してのみ行う必要があります。これはどのように見えるでしょうか?
さまざまな方法 (さまざまなハンドラーなど) を試しましたが、成功しませんでした: 両方のログ ファイルに書き込まれてもうまくいきませんでした。
問題をより具体的にするために-私が試した設定:
handler.performance.class=com.logging.handler.FileHandler
handler.performance.file=${LOGGING_ROOT}/performance.log
handler.performance.level=FINE
handler.fine.class=com.logging.handler.FileHandler
handler.fine.file=${LOGGING_ROOT}/finer.log
handler.fine.level=FINE
handler.async.class=com.logging.handler.AsyncBufferHandler
handler.async.level=ALL
handler.async.targets=fine
handler.asyncperf.class=com.logging.handler.AsyncBufferHandler
handler.asyncperf.level=ALL
handler.asyncperf.targets=performance
com.myapp.handlers=async,console
com.myapp.useParentHandlers=false
com.myapp.common.logging.handlers=asyncperf
com.myapp.common.logging.useParentHandlers=false
この別のパフォーマンス ログに記録したいクラスは、com.myapp.common.logging... の下にあります。