Custom Loggers
2 min read
2 min read
You have several options if you wish to install a logger other than the default one:
- Select one of the other built-in loggers, such as the file logger
- Supply your own logger implementation in InitializationDataInitializationDataInitializationDataInitializationDataInitializationData when you create a communicator
- Load a logger implementation dynamically via the Ice plug-in facility
- In Node.js, select the file logger
- Supply your own logger implementation in InitializationData when you create a communicator
- Select one of the other built-in loggers, such as the file logger
- Load a logger implemented in C++ via the Ice plug-in facility
A custom logger lets you integrate the messages the Ice runtime logs into your application's logging framework: your Logger implementation forwards each log message to this framework.
Implementing a Logger
A custom logger implements the LoggerLoggerLoggerLoggerLoggerLogger interface, whose methods are described in Logger Facility. The Ice runtime calls the logger from its own threads, concurrently, so the implementation must be thread-safe.
Logger Lifetime
Logger extends AutoCloseable. When you destroy a communicator, the communicator closes the logger it created from Ice.LogFile or Ice.UseSyslog, and the logger installed by a logger plug-in. You manage the lifetime of a logger you supply in InitializationData or install with setProcessLogger (see The Per-Process Logger).
Logger extends IDisposable. When you destroy a communicator, the communicator disposes the logger it created, either from Ice.LogFile or as its default logger, and the logger installed by a logger plug-in. You manage the lifetime of a logger you supply in InitializationData or install with setProcessLogger (see The Per-Process Logger).