org.kuali.common.util.log4j.model.Log4JContext Maven / Gradle / Ivy
/**
* Copyright 2010-2014 The Kuali Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.common.util.log4j.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.kuali.common.util.CollectionUtils;
/**
* @deprecated
*/
@Deprecated
@XmlRootElement(name = "log4j:configuration")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Log4JContext {
public static final Boolean DEFAULT_RESET_VALUE = false;
public static final Boolean DEFAULT_DEBUG_VALUE = false;
public static final Value DEFAULT_THRESHOLD_VALUE = Value.NULL;
Boolean reset = DEFAULT_RESET_VALUE;
Boolean debug = DEFAULT_DEBUG_VALUE;
Value threshold = DEFAULT_THRESHOLD_VALUE;
Logger root;
List appenders = new ArrayList();
List loggers = new ArrayList();
public Log4JContext() {
this(null, null);
}
public Log4JContext(List appenders, Logger root) {
this(appenders, root, null);
}
public Log4JContext(List appenders, Logger root, List loggers) {
this(appenders, root, loggers, DEFAULT_RESET_VALUE);
}
public Log4JContext(List appenders, Logger root, boolean reset) {
this(appenders, root, null, reset);
}
public Log4JContext(Appender appender, Logger root, boolean reset) {
this(Arrays.asList(appender), root, null, reset);
}
public Log4JContext(List appenders, Logger root, List loggers, boolean reset) {
super();
this.appenders = appenders;
this.root = root;
this.loggers = loggers;
this.reset = reset;
}
public Log4JContext(Log4JContext context) {
super();
this.reset = context.getReset();
this.debug = context.getDebug();
this.threshold = context.getThreshold();
this.root = context.getRoot();
for (Appender appender : CollectionUtils.toEmptyList(context.getAppenders())) {
this.appenders.add(new Appender(appender));
}
for (Logger logger : CollectionUtils.toEmptyList(context.getLoggers())) {
this.loggers.add(new Logger(logger));
}
}
@XmlAttribute
public Boolean getReset() {
return reset;
}
@XmlAttribute
public Boolean getDebug() {
return debug;
}
@XmlAttribute
public Value getThreshold() {
return threshold;
}
@XmlElement(name = "appender")
public List getAppenders() {
return appenders;
}
@XmlElement(name = "logger")
public List getLoggers() {
return loggers;
}
@XmlElement
public void setRoot(Logger root) {
this.root = root;
}
public void setReset(Boolean reset) {
this.reset = reset;
}
public void setDebug(Boolean debug) {
this.debug = debug;
}
public void setThreshold(Value threshold) {
this.threshold = threshold;
}
public void setAppenders(List appenders) {
this.appenders = appenders;
}
public void setLoggers(List loggers) {
this.loggers = loggers;
}
public Logger getRoot() {
return root;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy