The Per-Process Logger

Ice allows you to install a per-process custom logger. This logger is used by all communicators that do not have their own specific logger established at the time a communicator is created.

You can set a per-process logger by calling setProcessLogger, and you can retrieve the per-process logger by calling getProcessLogger:

namespace Ice
{
    std::shared_ptr<Ice::Logger> getProcessLogger();
    void setProcessLogger(const std::shared_ptr<Logger>&);
}
namespace Ice
{
    LoggerPtr getProcessLogger();
    void setProcessLogger(const LoggerPtr&);
}
namespace Ice
{
    public sealed class Util
    {
        public static Logger getProcessLogger() { ... }
        public static setProcessLogger(Logger logger) { ... }
        ...
    }
}
package com.zeroc.Ice;


public final class Util
{
    public static Logger getProcessLogger() { ... }
    public static setProcessLogger(Logger logger) { ... }
    ...
}
package Ice;


public final class Util
{
    public static Logger getProcessLogger() { ... }
    public static setProcessLogger(Logger logger) { ... }
    ...
}
# in Ice module:

def getProcessLogger():
    ...


def setProcessLogger(logger):
    ... 

If you call getProcessLogger without having called setProcessLogger first, the Ice run time installs a default per-process logger. Note that if you call setProcessLogger, only communicators created after that point will use this per-process logger; communicators created earlier use the logger that was in effect at the time they were created. (This also means that you can call setProcessLogger multiple times; communicators created after that point will use whatever logger was established by the last call to setProcessLogger.)

For applications that use the Application or Service convenience classes and do not explicitly configure a logger, these classes set a default per-process logger that uses the Ice.ProgramName property as a prefix for log messages.

See Also