Update of /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30233/src/main/java/org/webmacro Modified Files: Broker.java Context.java URLTemplateLoader.java WM.java WebMacro.java Removed Files: Log.java Log Message: Remove logging Index: URLTemplateLoader.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro/URLTemplateLoader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** URLTemplateLoader.java 18 Mar 2008 20:48:17 -0000 1.3 --- URLTemplateLoader.java 24 Feb 2010 21:02:04 -0000 1.4 *************** *** 26,29 **** --- 26,31 ---- import java.net.URL; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; import org.webmacro.resource.AbstractTemplateLoader; import org.webmacro.resource.CacheElement; *************** *** 39,42 **** --- 41,45 ---- { + static Logger _log = LoggerFactory.getLogger(URLTemplateLoader.class); private URL baseURI; *************** *** 49,53 **** catch (MalformedURLException e) { ! log.error("Cannot init url template loader, bad URL", e); } } --- 52,56 ---- catch (MalformedURLException e) { ! _log.error("Cannot init url template loader, bad URL", e); } } *************** *** 62,69 **** { URL url = new URL(baseURI, query); ! if (log.loggingDebug()) ! { ! log.debug("FileTemplateProvider: Found template " + url); ! } return helper.load(url, ce); } --- 65,69 ---- { URL url = new URL(baseURI, query); ! _log.debug("FileTemplateProvider: Found template " + url); return helper.load(url, ce); } Index: Context.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro/Context.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Context.java 20 Mar 2008 12:44:27 -0000 1.66 --- Context.java 24 Feb 2010 21:02:03 -0000 1.67 *************** *** 29,32 **** --- 29,34 ---- import java.util.Set; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; import org.webmacro.engine.EvaluationExceptionHandler; import org.webmacro.engine.FunctionCall; *************** *** 38,42 **** * via the Template.write() or Template.evaluate() methods. Actually * you can render any Macro object by passing a Context to its ! * write() or evaluat() method, not just templates. * <p> * A Context is a per-thread data structure. It should not be shared --- 40,44 ---- * via the Template.write() or Template.evaluate() methods. Actually * you can render any Macro object by passing a Context to its ! * write() or evaluate() method, not just templates. * <p> * A Context is a per-thread data structure. It should not be shared *************** *** 44,49 **** * of the state for a single request into the context and then execute * it, with each request having its own separate context. In this ! * thread-per-request worldview there is no reason to synchronize ! * the Context objects as they are not shared bewteen threads. * <p> * Ordinarily you acquire a Context object from the WebMacro --- 46,51 ---- * of the state for a single request into the context and then execute * it, with each request having its own separate context. In this ! * thread-per-request world view there is no reason to synchronize ! * the Context objects as they are not shared between threads. * <p> * Ordinarily you acquire a Context object from the WebMacro *************** *** 58,63 **** public class Context implements Map, Cloneable { private final Broker _broker; - private final Log _log; private HashMap _funcs = null; // lazy initialization --- 60,66 ---- public class Context implements Map, Cloneable { + static Logger _log = LoggerFactory.getLogger(Context.class); + private final Broker _broker; private HashMap _funcs = null; // lazy initialization *************** *** 85,89 **** { _broker = broker; - _log = broker.getLog("context", "property and evaluation errors"); } --- 88,91 ---- *************** *** 173,179 **** * into the log under the supplied log type. */ ! public final Log getLog (String type, String description) { ! return _broker.getLog(type, description); } --- 175,181 ---- * into the log under the supplied log type. */ ! public final Logger getLog (String type, String description) { ! return _log; } *************** *** 183,189 **** * be used as the description. */ ! public final Log getLog (String type) { ! return _broker.getLog(type, type); } --- 185,191 ---- * be used as the description. */ ! public final Logger getLog (String type) { ! return _log; } Index: WebMacro.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro/WebMacro.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** WebMacro.java 12 Nov 2008 20:55:47 -0000 1.19 --- WebMacro.java 24 Feb 2010 21:02:05 -0000 1.20 *************** *** 24,27 **** --- 24,29 ---- package org.webmacro; + import org.slf4j.Logger; + import java.io.OutputStream; import java.io.UnsupportedEncodingException; *************** *** 30,34 **** * WebMacro Manager Interface * ! * This interface provies root access into the WebMacro system. Use it to * obtain references to other WebMacro objects which you might need. * <p> --- 32,36 ---- * WebMacro Manager Interface * ! * This interface provides root access into the WebMacro system. Use it to * obtain references to other WebMacro objects which you might need. * <p> *************** *** 46,51 **** * No longer using ant filtering. */ ! public static final String VERSION = "2.1"; ! public static final String BUILD_DATE = "2008-11-13"; /** --- 48,53 ---- * No longer using ant filtering. */ ! public static final String VERSION = "2.2"; ! public static final String BUILD_DATE = "2010-02-22"; /** *************** *** 116,125 **** * control logging. */ ! public Log getLog (String type, String description); /** * Get a log using the type as the description */ ! public Log getLog (String type); /** --- 118,127 ---- * control logging. */ ! //public Logger getLog (String type, String description); /** * Get a log using the type as the description */ ! //public Logger getLog (String type); /** Index: WM.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro/WM.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** WM.java 19 Mar 2008 00:20:29 -0000 1.48 --- WM.java 24 Feb 2010 21:02:04 -0000 1.49 *************** *** 33,36 **** --- 33,39 ---- import javax.servlet.http.HttpServletResponse; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + import org.webmacro.servlet.ServletBroker; import org.webmacro.servlet.WebContext; *************** *** 48,51 **** --- 51,55 ---- public class WM implements WebMacro { + static Logger _log = LoggerFactory.getLogger(WM.class); // INIT METHODS--MANAGE ACCESS TO THE BROKER *************** *** 55,59 **** final private Provider _tmplProvider; final private Provider _urlProvider; - final private Log _log; --- 59,62 ---- *************** *** 135,140 **** _broker = broker; ! _log = _broker.getLog("wm", "WebMacro instance lifecycle"); ! _log.notice("new " + this + " v" + WebMacro.VERSION); try --- 138,142 ---- _broker = broker; ! _log.info("new " + this + " v" + WebMacro.VERSION); try *************** *** 260,271 **** /** ! * Get a log to write information to. Log type names should be lower * case and short. They may be printed on every line of the log * file. The description is a longer explanation of the type of ! * log messages you intend to produce with this Log object. */ ! final public Log getLog (String type, String description) { ! return _broker.getLog(type, description); } --- 262,273 ---- /** ! * Get a log to write information to. Logger type names should be lower * case and short. They may be printed on every line of the log * file. The description is a longer explanation of the type of ! * log messages you intend to produce with this Logger object. */ ! final public Logger getLog (String type, String description) { ! return _log; } *************** *** 273,279 **** * Get a log using the type as the description */ ! final public Log getLog (String type) { ! return _broker.getLog(type, type); } --- 275,281 ---- * Get a log using the type as the description */ ! final public Logger getLog (String type) { ! return _log; } Index: Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/webmacro/src/main/java/org/webmacro/Broker.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** Broker.java 21 Feb 2010 01:49:49 -0000 1.49 --- Broker.java 24 Feb 2010 21:02:02 -0000 1.50 *************** *** 40,43 **** --- 40,46 ---- import java.util.WeakHashMap; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + import org.webmacro.broker.ContextAutoLoader; import org.webmacro.engine.DefaultEvaluationExceptionHandler; *************** *** 46,53 **** import org.webmacro.engine.MethodWrapper; import org.webmacro.engine.PropertyOperatorCache; - import org.webmacro.util.LogFile; - import org.webmacro.util.LogSystem; - import org.webmacro.util.LogTarget; - import org.webmacro.util.LogTargetFactory; import org.webmacro.util.Settings; import org.webmacro.util.SubSettings; --- 49,52 ---- *************** *** 91,99 **** final protected Settings _config = new Settings(); final protected String _name; - final protected LogSystem _ls; final public PropertyOperatorCache _propertyOperators = new PropertyOperatorCache(); ! protected Log _log; private EvaluationExceptionHandler _eeHandler; --- 90,98 ---- final protected Settings _config = new Settings(); final protected String _name; final public PropertyOperatorCache _propertyOperators = new PropertyOperatorCache(); ! protected Logger _log = LoggerFactory.getLogger(Broker.class); ! private EvaluationExceptionHandler _eeHandler; *************** *** 138,143 **** loadSettings(WEBMACRO_PROPERTIES, true); loadSystemSettings(); ! initLog(); ! _log.notice("Loaded settings from " + propertySource); init(); } --- 137,141 ---- loadSettings(WEBMACRO_PROPERTIES, true); loadSystemSettings(); ! _log.info("Loaded settings from " + propertySource); init(); } *************** *** 157,162 **** loadSettings(props); loadSystemSettings(); ! initLog(); ! _log.notice("Loaded settings from " + propertySource); init(); } --- 155,159 ---- loadSettings(props); loadSystemSettings(); ! _log.info("Loaded settings from " + propertySource); init(); } *************** *** 179,184 **** loadSystemSettings(); propertySource += ", " + "(System Properties)"; ! initLog(); ! _log.notice("Loaded settings from " + propertySource); init(); } --- 176,180 ---- loadSystemSettings(); propertySource += ", " + "(System Properties)"; ! _log.info("Loaded settings from " + propertySource); init(); } *************** *** 196,259 **** { _name = name; - _ls = new LogSystem(_name); - _log = _ls.getLog("broker", "general object loader and configuration"); } - /** - * Constructors should call this after they've set up the properties - * to set up the log target. If subclasses are going to set up logging - * themselves, then they don't have to call it. - */ - protected void initLog () - { - final LogTargetFactory ltf = LogTargetFactory.getInstance(); - final Broker broker = this; - - if (!_config.containsKey("LogTargets")) - { - // no log targets defined so just start with the - // standard LogFile - try - { - _ls.addTarget(new LogFile(_config)); - } - catch (IOException e) - { - _log.error("Failed to open logfile", e); - } - } - else - { - // use whatever was defined in the configuration for this broker - _config.processListSetting("LogTargets", - new Settings.ListSettingHandler() - { - public void processSetting (String settingKey, - String settingValue) - { - try - { - LogTarget lt = ltf.createLogTarget(broker, - settingValue, - _config); - _ls.addTarget(lt); - } - catch (LogTargetFactory.LogCreationException e) - { - _log.error("Broker unable to init log " - + settingValue, e); - } - } - } - ); - } - - _log.notice("starting " + this.getClass().getName() + ": " + _name); - } /** * Provide access to the broker's log. */ ! public Log getBrokerLog() { return _log; --- 192,202 ---- { _name = name; } /** * Provide access to the broker's log. */ ! public Logger getBrokerLog() { return _log; *************** *** 307,311 **** // Write out our properties as debug records ! if (_log.loggingDebug()) { String[] properties = _config.getKeys(); --- 250,254 ---- // Write out our properties as debug records ! if (_log.isDebugEnabled()) { String[] properties = _config.getKeys(); *************** *** 339,343 **** catch (Exception e) { ! _log.warning("Unable to instantiate exception handler of class " + eehClass + "; " + e); } --- 282,286 ---- catch (Exception e) { ! _log.warn("Unable to instantiate exception handler of class " + eehClass + "; " + e); } *************** *** 482,488 **** catch (InitException e) { ! Log log = LogSystem.getSystemLog("wm"); ! log.error("Failed to initialize WebMacro with default config"); ! throw e; } } --- 425,429 ---- catch (InitException e) { ! throw new InitException("Failed to initialize WebMacro with default config",e); } } *************** *** 490,530 **** public static Broker getBroker (Properties p) throws InitException { ! try ! { ! Broker b = findBroker(p); ! if (b == null) ! { ! b = new Broker(p); ! register(p, b); ! } ! return b; ! } ! catch (InitException e) { ! Log log = LogSystem.getSystemLog("wm"); ! log.error("Failed to initialize WebMacro with default config"); ! throw e; } } public static Broker getBroker (String settingsFile) throws InitException { ! try ! { ! Broker b = findBroker(settingsFile); ! if (b == null) ! { ! b = new Broker(settingsFile); ! register(settingsFile, b); ! } ! ! return b; ! } ! catch (InitException e) { ! Log log = LogSystem.getSystemLog("wm"); ! log.error("Failed to initialize WebMacro from " + settingsFile); ! throw e; } } --- 431,453 ---- public static Broker getBroker (Properties p) throws InitException { ! Broker b = findBroker(p); ! if (b == null) { ! b = new Broker(p); ! register(p, b); } + return b; } public static Broker getBroker (String settingsFile) throws InitException { ! Broker b = findBroker(settingsFile); ! if (b == null) { ! b = new Broker(settingsFile); ! register(settingsFile, b); } + + return b; } *************** *** 546,550 **** } } ! // _log.notice("Loading properties file " + WEBMACRO_DEFAULTS); _config.load(_defaultSettings); } --- 469,473 ---- } } ! // _log.info("Loading properties file " + WEBMACRO_DEFAULTS); _config.load(_defaultSettings); } *************** *** 565,569 **** if (optional) { ! _log.notice("Cannot find properties file " + name + ", continuing"); } e.printStackTrace(); --- 488,492 ---- if (optional) { ! _log.info("Cannot find properties file " + name + ", continuing"); } e.printStackTrace(); *************** *** 591,595 **** protected void loadSystemSettings () { ! // _log.notice("Loading properties from system properties"); _config.load(System.getProperties(), SETTINGS_PREFIX); } --- 514,518 ---- protected void loadSystemSettings () { ! // _log.info("Loading properties from system properties"); _config.load(System.getProperties(), SETTINGS_PREFIX); } *************** *** 725,754 **** /** - * Get a log: the behavior of this log depends on the configuration - * of the broker. If your system loads from a WebMacro.properties - * file then look in there for details about setting up and - * controlling the Log. - * <p> - * You should try and hang on to the Log you get back from this - * method since creating new Log objects can be expensive. You - * also likely pay for IO when you use a log object. - * <p> - * The type you supply will be associated with your log messages - * in the log file. - */ - public Log getLog (String type, String description) - { - return _ls.getLog(type, description); - } - - /** - * Shortcut: create a new log using the type as the description - */ - public Log getLog (String type) - { - return _ls.getLog(type, type); - } - - /** * Get a new FastWriter * A FastWriter is used when writing templates to an output stream --- 648,651 ---- --- Log.java DELETED --- |