public void begin(ExecutionContext ec, String name, Attributes attributes) {
// Let us forget about previous errors (in this object)
inError = false;
LoggerRepository repository = (LoggerRepository) ec.getObject(0);
// Create a new org.apache.log4j.Category object from the <category> element.
String loggerName = attributes.getValue(NAME_ATTRIBUTE);
if (Option.isEmpty(loggerName)) {
inError = true;
String line =
", around line " + getLineNumber(ec) + " column "
+ getColumnNumber(ec);
String errorMsg = "No 'name' attribute in element " + name + line;
getLogger().warn(errorMsg);
ec.addError(new ErrorItem(errorMsg));
return;
}
getLogger().debug("Logger name is [" + loggerName + "].");
Logger l;
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (Option.isEmpty(className)) {
getLogger().debug("Retreiving an instance of org.apache.log4j.getLogger().");
l = repository.getLogger(loggerName);
} else {
getLogger().debug("Desired logger sub-class: [" + className + ']');
try {
Class clazz = Loader.loadClass(className);