开发者

How do I configure java.util.logging within an Eclipse plug-in?

开发者 https://www.devze.com 2023-01-04 12:11 出处:网络
I am new to creating plug-ins, and there\'s much that I don\'t understand.One of these mysteries is logging.

I am new to creating plug-ins, and there's much that I don't understand. One of these mysteries is logging.

I have legacy code that I want to be able to use both within the plug-in and in the old standalone code. This code uses java.util.logging.

I debug my plug-in by starting up a new workbench using a JVM option -Djava.util.logging.config.file=/completelySpecifiedPath/logging.properties. The logging.properties file appears to be read, because the开发者_运维技巧 file specified by java.util.logging.FileHandler.pattern is being written. Unfortunately, the custom formatter that I specified via java.util.logging.FileHandler.formatter does not seem to get called; the output in the file is in what looks to be a default XML format. The logging works okay in the legacy code, i.e., my custom formatter gets used.

One thing I am wondering about is how the plug-in handles the logging dependencies. Is it possible that I need to explicitly enter some logging dependencies in MANIFEST.MF? I don't see how Eclipse could calculate the dependency for me, because the dependency isn't in code, rather it's in the logging.properties file. Furthermore, is it possible or desirable to say that java.util.logging depends on my class?

Any help and/or ideas would be much appreciated.

Cheers, Keith


This appears to be an Eclipse bug that won't be fixed any time soon. If you want to use a custom formatter, you'll need to specify it in code, rather than by using logging.properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号