---
title: "Custom Loggers"
url: https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Custom Loggers

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/php.md), [Python](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/administration/logger-facility/custom-loggers/swift.md).

You have several options if you wish to install a logger other than the default one:

> **C++, C#, Java, Python, and Swift**
>
> - Select one of the other [built-in loggers](https://docs.zeroc.com/ice/3.8/administration/logger-facility/built-in-loggers.md), such as the file logger
> - Supply your own logger implementation in InitializationData ([C++](https://code.zeroc.com/ice/3.8/api/cpp/structIce_1_1InitializationData.html), [C#](https://code.zeroc.com/ice/3.8/api/csharp/api/Ice.InitializationData.html), [Java](https://code.zeroc.com/ice/3.8/api/java/com.zeroc.ice/com/zeroc/Ice/InitializationData.html), [Python](https://code.zeroc.com/ice/3.8/api/python/Ice.InitializationData.html), and [Swift](https://code.zeroc.com/ice/3.8/api/swift/documentation/ice/initializationdata)) when you create a communicator
> - Load a logger implementation dynamically via the Ice [plug-in facility](https://docs.zeroc.com/ice/3.8/plugins/custom-logger-plug-in.md)

> **JavaScript**
>
> - In Node.js, select the [file logger](https://docs.zeroc.com/ice/3.8/administration/logger-facility/built-in-loggers/js.md)
> - Supply your own logger implementation in [InitializationData](https://code.zeroc.com/ice/3.8/api/javascript/Ice/InitializationData.html) when you create a communicator

> **Ruby, PHP, and MATLAB**
>
> - Select one of the other [built-in loggers](https://docs.zeroc.com/ice/3.8/administration/logger-facility/built-in-loggers.md), such as the file logger
> - Load a logger implemented in C++ via the Ice [plug-in facility](https://docs.zeroc.com/ice/3.8/plugins/custom-logger-plug-in.md)

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.

> **C++, C#, Java, JavaScript, Python, and Swift**
>
> ## Implementing a Logger
>
> A custom logger implements the Logger ([C++](https://code.zeroc.com/ice/3.8/api/cpp/classIce_1_1Logger.html), [C#](https://code.zeroc.com/ice/3.8/api/csharp/api/Ice.Logger.html), [Java](https://code.zeroc.com/ice/3.8/api/java/com.zeroc.ice/com/zeroc/Ice/Logger.html), [JavaScript](https://code.zeroc.com/ice/3.8/api/javascript/Ice/Logger.html), [Python](https://code.zeroc.com/ice/3.8/api/python/Ice.Logger.html), and [Swift](https://code.zeroc.com/ice/3.8/api/swift/documentation/ice/logger)) interface, whose methods are described in [Logger Facility](https://docs.zeroc.com/ice/3.8/administration/logger-facility.md). (C++, C#, Java, Python, and Swift: The Ice runtime calls the logger from its own threads, concurrently, so the implementation must be thread-safe.)

> **C# and Java**
>
> ## Logger Lifetime

> **Java**
>
> `Logger` extends `AutoCloseable`. When you destroy a communicator, the communicator closes the logger it created from [Ice.LogFile](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties/java.md#ice.logfile) or [Ice.UseSyslog](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties/java.md#ice.usesyslog), and the logger installed by a [logger plug-in](https://docs.zeroc.com/ice/3.8/plugins/custom-logger-plug-in/java.md). You manage the lifetime of a logger you supply in `InitializationData` or install with `setProcessLogger` (see [The Per-Process Logger](https://docs.zeroc.com/ice/3.8/administration/logger-facility/per-process-logger/java.md)).

> **C#**
>
> `Logger` extends `IDisposable`. When you destroy a communicator, the communicator disposes the logger it created, either from [Ice.LogFile](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties/csharp.md#ice.logfile) or as its default logger, and the logger installed by a [logger plug-in](https://docs.zeroc.com/ice/3.8/plugins/custom-logger-plug-in/csharp.md). You manage the lifetime of a logger you supply in `InitializationData` or install with `setProcessLogger` (see [The Per-Process Logger](https://docs.zeroc.com/ice/3.8/administration/logger-facility/per-process-logger/csharp.md)).

## See Also

- [Built-in Loggers](https://docs.zeroc.com/ice/3.8/administration/logger-facility/built-in-loggers.md)
- [Custom Logger Plug-in](https://docs.zeroc.com/ice/3.8/plugins/custom-logger-plug-in.md)
