Set logging options at runtime (Java API)
You have the ability to set Java GGC API logging options at runtime.
GGC 4.00 added the class com.fourjs.ggc.util.logger.LoggerConfig
.
GGC 4.00 added methods in com.fourjs.util.logger.Logger
:
LoggerConfig getConfiguration()
void setConfiguration(LoggerConfig);
LoggerConfig
returns Console and File configuration (com.fourjs.ggc.util.logger.ConsoleConfig
and
com.fourjs.ggc.util.logger.FileConfig
). ConsoleConfig
and FileConfig
have a getBuilder()
method returning a Builder
with the current configuration
settings. SessionManagerBuilder
allow you to provide a default logger configuration (with the
LoggerConfig()
method); if a default logger configuration is not provided, the logger configuration is
read from the log configuration files as set for the GGC in the ~/.ggc/log.properties file.
TCPConfig
and UAConfig
Builders
allow you to provide a logger configuration (with the LoggerConfig()
method);
if a default logger configuration is not provided, the session manager's configuration is used.
com.fourjs.ggc.util.logger.*
now included in the javadoc, see Java API functions for GGC.
Usage example
LoggerConfig lc = client.getLogger().getConfiguration();
client.getLogger()
.setConfiguration(new LoggerConfig(
lc.consoleConfig().getBuilder().setEnabled(true).build(),
lc.fileConfig().getBuilder().setDirectory(new File(pathToLogs)).setEnabled(true).build())
);