X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Flog%2Flog4j%2FLoggerImpl.java;h=cd80fd8374a30ac5bcf92f1fdb2ff3ff996a642d;hb=63e0ee1fb8038eb6d8f0190cf38c3b3ab2727216;hp=99ebed480a76412ee57f610a85b2dceb8a9eed48;hpb=8b91e8d8bf4a31a88440a404e83238dcf32f8f4a;p=mir.git diff --git a/source/mir/log/log4j/LoggerImpl.java b/source/mir/log/log4j/LoggerImpl.java index 99ebed48..cd80fd83 100755 --- a/source/mir/log/log4j/LoggerImpl.java +++ b/source/mir/log/log4j/LoggerImpl.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mir.log.log4j; @@ -33,8 +33,8 @@ import java.util.HashMap; import java.util.Map; import mir.config.MirPropertiesConfiguration; -import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; - +import mir.log.LoggerExc; +import mir.log.LoggerFailure; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; @@ -42,33 +42,53 @@ import org.apache.log4j.PropertyConfigurator; public class LoggerImpl implements mir.log.Logger { private static Map loggers = new HashMap(); - public LoggerImpl() throws PropertiesConfigExc { - System.setProperty("log.home", - MirPropertiesConfiguration.instance().getStringWithHome("Log.Home")); - PropertyConfigurator.configure( - MirPropertiesConfiguration.instance().getStringWithHome("Log.log4j.ConfigurationFile").trim()); + public LoggerImpl() throws LoggerExc { + reload(); } + /** {@inheritDoc} */ public void debug(Object o, String s) { this.getLogger(o).debug(s); } + /** {@inheritDoc} */ public void info(Object o, String s) { this.getLogger(o).info(s); } + /** {@inheritDoc} */ public void warn(Object o, String s) { this.getLogger(o).warn(s); } + /** {@inheritDoc} */ public void error(Object o, String s) { this.getLogger(o).error(s); } + /** {@inheritDoc} */ public void fatal(Object o, String s) { this.getLogger(o).fatal(s); } + /** {@inheritDoc} */ + public void reload() throws LoggerExc, LoggerFailure { + try { + synchronized (loggers) { + System.setProperty("log.home", + MirPropertiesConfiguration.instance().getFile("Log.Home").getAbsolutePath()); + + PropertyConfigurator.configure( + MirPropertiesConfiguration.instance().getFile("Log.log4j.ConfigurationFile").getAbsolutePath()); + + loggers.clear(); + } + } + catch (Throwable t) { + throw new LoggerFailure(t); + } + } + private Logger getLogger(Object o) { String name; Logger l;