// make handlers
try {
Configuration[] handlerConfigs = config.getChildren("handler");
for (int i = 0; i < handlerConfigs.length; ++i) {
Configuration handlerConfig = handlerConfigs[i];
String handlerName = handlerConfig.getChild("handler-name")
.getValue();
// create handler
Handler handler = (Handler) InstanceCreator
.createConfiguredInstance(handlerConfig
.getChild("configured-object"));
// set level if necessary
try {
String level = handlerConfig.getChild("level")
.getValue();
handler.setLevel(Level.parse(level));
} catch (NotFoundXmlTagException notFoundEx) {
out.println("handler:" + handlerName
+ " :skipped setting level.");
}
// set formatter if necessary
try {
String formatterName = handlerConfig.getChild(
"formatter").getValue();
java.util.logging.Formatter formatter = (java.util.logging.Formatter) Class
.forName(formatterName).newInstance();
handler.setFormatter(formatter);
} catch (NotFoundXmlTagException notFoundEx) {
out.println("handler:" + handlerName
+ " :skipped setting formatter.");
}
// set encoding if necessary
try {
String encoding = handlerConfig.getChild("encoding")
.getValue();
handler.setEncoding(encoding);
} catch (NotFoundXmlTagException notFoundEx) {
out.println("handler:" + handlerName
+ ":skipped setting encoding charset.");
}
// ���̺� ��� ���ѵд�.
handlers.put(handlerName, handler);
}
} catch (NotFoundXmlTagException noTag) {
out.println("skipped making handlers.");
}
// loggers
try {
Configuration[] loggerConfigs = config.getChildren("logger");
for (int i = 0; i < loggerConfigs.length; ++i) {
Configuration loggerConfig = loggerConfigs[i];
String loggerName = loggerConfig.getChild("logger-name")
.getValue();
Logger logger = Logger.getLogger(loggerName);
Configuration[] handlerNameConfigs = loggerConfig
.getChildren("handler-name");
for (int j = 0; j < handlerNameConfigs.length; ++j) {
String handlerName = handlerNameConfigs[j].getValue();
Handler handler = (Handler) handlers.get(handlerName);
if (handler == null)
throw new InvalidSetupException(
"not found handler:" + handlerName);
logger.addHandler(handler);
}
}
} catch (NotFoundXmlTagException noTag) {
out.println("skipped setting loggers.");
}
// mapping
try {
Configuration[] loggerMappingConfigs = config
.getChildren("logger-mapping");
for (int i = 0; i < loggerMappingConfigs.length; ++i) {
Configuration loggerMappingConfig = loggerMappingConfigs[i];
String pattern = loggerMappingConfig.getChild("pattern")
.getValue();
String loggerName = loggerMappingConfig.getChild(
"logger-name").getValue();
addMapping(pattern, loggerName);
}
} catch (NotFoundXmlTagException noTag) {