|
Summary: Loggers and logger configuration with the Service Grid is done by extending Java Logging capabilities
Using Dynamic Logger ConfigurationThe LoggerConfig mechanism (org.jini.rio.log.LoggerConfig; see Javadoc) has been provided for dynamic services (ServiceBeans) can specify named Logger attributes (Levels, Handlers, etc...) in runtime without depending on logger.properties attributes and values to be set. Using the Logging element in the OperationalString Document<Logging> <Logger Name="examples.hello" Level="ALL"> <Handler ClassName="java.util.logging.ConsoleHandler" Level="ALL"/> </Logger> </Logging> If we were to choose a java.util.FileHandler as the Handler the declaration would be as follows: <Logging> <Logger Name="examples.hello" Level="ALL"> <Handler ClassName="java.util.logging.FileHandler" Level="ALL"> <Parameters> <Parameter Name="java.lang.String" Value="${user.name}/hello%u.log"/> <Parameter Name="boolean" Value="true"/> </Parameters> <Formatter ClassName="java.util.logging.SimpleFormatter"/> </Handler> </Logger> </Logging> Note the use of ${user.name}. This value refers to the value of a system property by using the syntax ${propertyName} within the Value literal. The ${user.name} property gets resolved as the user's account name that is running the JVM the service is instantiated within. Using LoggerConfig in a Configuration Fileimport java.util.logging.ConsoleHandler; import java.util.logging.Level; import org.jini.rio.log.LoggerConfig; com.foo { ... loggerConfigs = new LoggerConfig[] { new LoggerConfig("com.foo", Level.ALL, false, new LogHandlerConfig[]{ new LogHandlerConfig(new ConsoleHandler(), Level.FINE) }) }; ... } How the LoggerConfig Gets CreatedAs part of the ServiceBean instantiation process the LoggerConfig object (if included in the ServiceBean's ServiceBeanConfig object) will be instantiated by GSC infrastructure elements, created the desired Logger configuration (it should be noted that if the Logger already exists, the Level of the Logger being requested using the LogerConfig mechanisms will only be set if the the Level is less then the current Level). The service can get the named Logger using normal mechanisms (Logger.getLogger("logger-name")). LoggersThe ServiceGrid module uses a number of different Logger components. Each logger component along with what gets logged is listed below:
RELATED TOPICS |
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment