I'd like to customize the way a Muse web service is logging information. I found the following so far:
- Muse uses the JDK logging API
Logging is done with the JDK logging API. The two elements under <logging/> - <log-file/> and <log-level/> - allow you to specify where the Muse log file will be written and at what level of detail it should record, respectively.
The log file path should be relative to the application's working directory; in the case of the J2EE, this is the root of the WAR. The sample project will create a log file at /WEB-INF/services/muse/log/muse.log. The file will be overwritten each time the application is restarted.
- Java Logging can be extended with new handlers
J2SE provides the following Handlers:
* StreamHandler: A simple handler for writing formatted records to an OutputStream. * ConsoleHandler: A simple handler for writing formatted records to System.err * FileHandler: A handler that writes formatted log records either to a single file, or to a set of rotating log files. * SocketHandler: A handler that writes formatted log records to remote TCP ports. * MemoryHandler: A handler that buffers log records in memory.
It is fairly straightforward to develop new Handlers. Developers requiring specific functionality can either develop a Handler from scratch or subclass one of the provided Handlers.
Obviously one needs to write a configuration file:
The logging configuration can be initialized using a logging configuration file that will be read at startup. This logging configuration file is in standard java.util.Properties format.
But my gut feeling is that the muse framework programmatically configures the logging framework based on the values read from the muse.xml. In that case, there is no way one can use a custom handler, is there? Let alone use a pre-existing one.
Does anyone have an idea? What would be the behavior if I did put in a logging config file? I suppose that the assumed programatic configuration would overwrite the one from the file effectively cancelling out the config file's effect.
No matter what they say in Ohio, we're still first in flight!