Author: jacopoc
Date: Tue Aug 19 10:36:01 2014 New Revision: 1618831 URL: http://svn.apache.org/r1618831 Log: OFBIZ-5287: Upgrade to Log4j2 Added: ofbiz/trunk/framework/base/config/log4j2.xml (with props) ofbiz/trunk/framework/base/lib/log4j-1.2-api-2.0.1.jar (with props) ofbiz/trunk/framework/base/lib/log4j-api-2.0.1.jar (with props) ofbiz/trunk/framework/base/lib/log4j-core-2.0.1.jar (with props) ofbiz/trunk/framework/base/lib/log4j-jcl-2.0.1.jar (with props) ofbiz/trunk/framework/base/lib/log4j-slf4j-impl-2.0.1.jar (with props) Removed: ofbiz/trunk/framework/base/config/log4j.xml ofbiz/trunk/framework/base/lib/avalon-util-exception-1.0.0.jar ofbiz/trunk/framework/base/lib/log4j-1.2.17.jar ofbiz/trunk/framework/base/lib/slf4j-log4j12-1.6.4.jar ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Log4jLoggerWriter.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/NotifyLevel.java Modified: ofbiz/trunk/LICENSE ofbiz/trunk/framework/base/config/debug.properties ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java ofbiz/trunk/framework/common/servicedef/services.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml ofbiz/trunk/framework/webtools/widget/LogForms.xml ofbiz/trunk/framework/webtools/widget/LogScreens.xml ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Modified: ofbiz/trunk/LICENSE URL: http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/LICENSE (original) +++ ofbiz/trunk/LICENSE Tue Aug 19 10:36:01 2014 @@ -28,7 +28,11 @@ framework/base/lib/jakarta-regexp-1.5.ja framework/base/lib/jpim-0.1.jar framework/base/lib/juel-impl-2.2.7.jar framework/base/lib/juel-spi-2.2.7.jar -framework/base/lib/log4j-1.2.17.jar +framework/base/lib/log4j-1.2-api-2.0.1.jar +framework/base/lib/log4j-api-2.0.1.jar +framework/base/lib/log4j-core-2.0.1.jar +framework/base/lib/log4j-jcl-2.0.1.jar +framework/base/lib/log4j-slf4j-impl-2.0.1.jar framework/base/lib/mx4j-3.0.1.jar framework/base/lib/mx4j-remote-3.0.1.jar framework/base/lib/nekohtml-1.9.16.jar @@ -1214,7 +1218,6 @@ MIT/X License: framework/base/lib/icu4j-52_1.jar framework/base/lib/jcl-over-slf4j-1.6.4.jar framework/base/lib/slf4j-api-1.6.4.jar -framework/base/lib/slf4j-log4j12-1.6.4.jar framework/images/webapp/images/jquery/* framework/images/webapp/images/date/date.format-1.2.3*.js ========================================================================= Modified: ofbiz/trunk/framework/base/config/debug.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/debug.properties?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/base/config/debug.properties (original) +++ ofbiz/trunk/framework/base/config/debug.properties Tue Aug 19 10:36:01 2014 @@ -21,12 +21,6 @@ # OFBiz Debug Settings #### -# Pack Exception Report Using Avalon Exception Util -pack.exception=true - -# Disable log4j config (used when other app servers handle the config) -disable.log4j.config=false - # These top level switches are used before calling Log4J, or if Log4J is not used print.verbose=false print.timing=true Added: ofbiz/trunk/framework/base/config/log4j2.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/log4j2.xml?rev=1618831&view=auto ============================================================================== --- ofbiz/trunk/framework/base/config/log4j2.xml (added) +++ ofbiz/trunk/framework/base/config/log4j2.xml Tue Aug 19 10:36:01 2014 @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration monitorInterval="60"> + <Appenders> + <Console name="stdout" target="SYSTEM_OUT"> + <PatternLayout pattern="%date{COMPACT} |%-20.20thread |%-20.20logger{1}|%level{length=1}| %message%n"/> + </Console> + <RollingFile name="ofbiz" fileName="runtime/logs/ofbiz.log" + filePattern="runtime/logs/ofbiz-%d{yyyy-MM-dd}-%i.log.zip"> + <PatternLayout pattern="%date{COMPACT} |%-20.20thread |%-20.20logger{1}|%level{length=1}| %message%n"/> + <Policies> + <TimeBasedTriggeringPolicy/> + <SizeBasedTriggeringPolicy size="1 MB"/> + </Policies> + <DefaultRolloverStrategy max="4"/> + </RollingFile> + <RollingFile name="external" fileName="runtime/logs/external.log" + filePattern="runtime/logs/external-%d{yyyy-MM-dd}-%i.log.zip"> + <PatternLayout pattern="%date{COMPACT} |%-20.20thread |%-20.20logger{1}|%level{length=1}| %message%n"/> + <Policies> + <TimeBasedTriggeringPolicy/> + <SizeBasedTriggeringPolicy size="1 MB"/> + </Policies> + <DefaultRolloverStrategy max="4"/> + </RollingFile> + <Async name="async"> + <AppenderRef ref="ofbiz"/> + <AppenderRef ref="stdout"/> + </Async> + </Appenders> + <Loggers> + <logger name="org.ofbiz.base.converter.Converters" level="warn"/> + <logger name="org.apache" level="warn" additivity="false"> + <appender-ref ref="external"/> + </logger> + <logger name="org.apache.tomcat" level="info" additivity="true"> + <appender-ref ref="external"/> + </logger> + <logger name="org.apache.catalina" level="info" additivity="true"> + <appender-ref ref="external"/> + </logger> + <logger name="freemarker" level="warn" additivity="false"> + <appender-ref ref="external"/> + </logger> + + <Root level="all"> + <AppenderRef ref="async"/> + </Root> + </Loggers> +</Configuration> Propchange: ofbiz/trunk/framework/base/config/log4j2.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/base/config/log4j2.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/base/config/log4j2.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/base/lib/log4j-1.2-api-2.0.1.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/log4j-1.2-api-2.0.1.jar?rev=1618831&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/log4j-1.2-api-2.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/base/lib/log4j-api-2.0.1.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/log4j-api-2.0.1.jar?rev=1618831&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/log4j-api-2.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/base/lib/log4j-core-2.0.1.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/log4j-core-2.0.1.jar?rev=1618831&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/log4j-core-2.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/base/lib/log4j-jcl-2.0.1.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/log4j-jcl-2.0.1.jar?rev=1618831&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/log4j-jcl-2.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/base/lib/log4j-slf4j-impl-2.0.1.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/log4j-slf4j-impl-2.0.1.jar?rev=1618831&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/log4j-slf4j-impl-2.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java Tue Aug 19 10:36:01 2014 @@ -27,8 +27,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.apache.log4j.Appender; -import org.apache.log4j.Logger; import org.ofbiz.base.component.ComponentConfig; import org.ofbiz.base.start.Config; import org.ofbiz.base.start.StartupException; @@ -270,12 +268,6 @@ public class ContainerLoader implements Debug.logInfo("Stopped container " + container.getName(), module); } } - @SuppressWarnings("unchecked") - Enumeration<Appender> en = Logger.getRootLogger().getAllAppenders(); - while (en.hasMoreElements()) { - Appender appender = en.nextElement(); - appender.close(); - } } } } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java Tue Aug 19 10:36:01 2014 @@ -18,23 +18,15 @@ *******************************************************************************/ package org.ofbiz.base.util; -import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; -import java.util.Enumeration; import java.util.Formatter; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import org.apache.avalon.util.exception.ExceptionHelper; -import org.apache.log4j.Appender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.RollingFileAppender; -import org.apache.log4j.spi.LoggerRepository; +import org.apache.logging.log4j.*; import org.ofbiz.base.conversion.ConversionException; import org.ofbiz.base.conversion.DateTimeConverters.DateToString; @@ -57,22 +49,20 @@ public final class Debug { public static final int WARNING = 5; public static final int ERROR = 6; public static final int FATAL = 7; - public static final int NOTIFY = 8; - public static final String[] levels = {"Always", "Verbose", "Timing", "Info", "Important", "Warning", "Error", "Fatal", "Notify"}; - public static final String[] levelProps = {"", "print.verbose", "print.timing", "print.info", "print.important", "print.warning", "print.error", "print.fatal", "print.notify"}; - public static final Level[] levelObjs = {Level.INFO, Level.DEBUG, Level.INFO, Level.INFO, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL, NotifyLevel.NOTIFY}; + public static final String[] levels = {"Always", "Verbose", "Timing", "Info", "Important", "Warning", "Error", "Fatal"}; + public static final String[] levelProps = {"", "print.verbose", "print.timing", "print.info", "print.important", "print.warning", "print.error", "print.fatal"}; + public static final Level[] levelObjs = {Level.FATAL, Level.DEBUG, Level.TRACE, Level.INFO, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL}; protected static Map<String, Integer> levelStringMap = new HashMap<String, Integer>(); protected static PrintStream printStream = System.out; protected static PrintWriter printWriter = new PrintWriter(printStream); - protected static boolean levelOnCache[] = new boolean[9]; - protected static boolean packException = true; + protected static boolean levelOnCache[] = new boolean[8]; protected static final boolean useLevelOnCache = true; - protected static Logger root = Logger.getRootLogger(); + protected static Logger root = LogManager.getRootLogger(); static { levelStringMap.put("verbose", Debug.VERBOSE); @@ -83,32 +73,11 @@ public final class Debug { levelStringMap.put("error", Debug.ERROR); levelStringMap.put("fatal", Debug.FATAL); levelStringMap.put("always", Debug.ALWAYS); - levelStringMap.put("notify", Debug.NOTIFY); - - // initialize Log4J - if (!UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", "disable.log4j.config", "true")) { - org.apache.log4j.xml.DOMConfigurator.configure(UtilURL.fromResource("log4j.xml")); - } // initialize levelOnCache - for (int i = 0; i < 9; i++) { + for (int i = 0; i < levelOnCache.length; i++) { levelOnCache[i] = (i == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", levelProps[i], "true")); } - - if (SYS_DEBUG != null) { - for (int x = 0; x < 8; x++) { - levelOnCache[x] = true; - } - LoggerRepository repo = root.getLoggerRepository(); - Enumeration<Logger> en = UtilGenerics.cast(repo.getCurrentLoggers()); - while (en.hasMoreElements()) { - Logger thisLogger = en.nextElement(); - thisLogger.setLevel(Level.DEBUG); - } - } - - // configure exception packing - packException = UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", "pack.exception", "true"); } public static PrintStream getPrintStream() { @@ -126,7 +95,7 @@ public final class Debug { public static Logger getLogger(String module) { if (UtilValidate.isNotEmpty(module)) { - return Logger.getLogger(module); + return LogManager.getLogger(module); } else { return root; } @@ -138,16 +107,6 @@ public final class Debug { return levelStringMap.get(levelName.toLowerCase()); } - /** Gets an int representing the level number from a String representing the level name; if level not found defaults to Debug.INFO */ - public static int getLevelFromStringWithDefault(String levelName) { - Integer levelInt = getLevelFromString(levelName); - if (levelInt == null) { - return Debug.INFO; - } else { - return levelInt; - } - } - public static void log(int level, Throwable t, String msg, String module) { log(level, t, msg, module, "org.ofbiz.base.util.Debug", emptyParams); } @@ -161,86 +120,19 @@ public final class Debug { } public static void log(int level, Throwable t, String msg, String module, String callingClass, Object... params) { - Logger logger = null; - boolean offSetInLogConfig = false; - boolean fatalSetInLogConfig = false; - boolean errorSetInLogConfig = false; - boolean warnSetInLogConfig = false; - boolean infoSetInLogConfig = false; - boolean traceSetInLogConfig = false; - boolean debugSetInLogConfig = false; - boolean allSetInLogConfig = false; - boolean setInLogConfig = false; - - if (useLog4J) { - logger = getLogger(module); - - // Class - if (logger != null) { - Level loggerLevel = logger.getLevel(); - offSetInLogConfig = Level.OFF.equals(loggerLevel); - fatalSetInLogConfig = Level.FATAL.equals(loggerLevel); - errorSetInLogConfig = Level.ERROR.equals(loggerLevel); - warnSetInLogConfig = Level.WARN.equals(loggerLevel); - infoSetInLogConfig = Level.INFO.equals(loggerLevel); - traceSetInLogConfig = Level.TRACE.equals(loggerLevel); - debugSetInLogConfig = Level.DEBUG.equals(loggerLevel); - allSetInLogConfig = Level.ALL.equals(loggerLevel); - } - setInLogConfig = offSetInLogConfig || fatalSetInLogConfig || errorSetInLogConfig || warnSetInLogConfig || infoSetInLogConfig - || traceSetInLogConfig || debugSetInLogConfig || allSetInLogConfig; - // Package - // !setInLogConfig : for a Class logger, Class setting takes precedence on Package if both are used - if (!noModuleModule.equals(module) && module != null && !module.isEmpty() && !setInLogConfig) { - Logger packageLogger = getLogger(module.substring(0, module.lastIndexOf("."))); - if (packageLogger != null) { - Level packageLoggerLevel = packageLogger.getLevel(); - offSetInLogConfig |= Level.OFF.equals(packageLoggerLevel); - fatalSetInLogConfig |= Level.FATAL.equals(packageLoggerLevel); - errorSetInLogConfig |= Level.ERROR.equals(packageLoggerLevel); - warnSetInLogConfig |= Level.WARN.equals(packageLoggerLevel); - infoSetInLogConfig |= Level.INFO.equals(packageLoggerLevel); - traceSetInLogConfig |= Level.TRACE.equals(packageLoggerLevel); - debugSetInLogConfig |= Level.DEBUG.equals(packageLoggerLevel); - allSetInLogConfig |= Level.ALL.equals(packageLoggerLevel); - } - } - setInLogConfig = offSetInLogConfig || fatalSetInLogConfig || errorSetInLogConfig || warnSetInLogConfig || infoSetInLogConfig - || traceSetInLogConfig || debugSetInLogConfig || allSetInLogConfig; - } - - if (isOn(level) || setInLogConfig) { + if (isOn(level)) { if (msg != null && params.length > 0) { StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb); formatter.format(msg, params); msg = sb.toString(); } - // pack the exception - if (packException && t != null) { - msg = System.getProperty("line.separator") + ExceptionHelper.packException(msg, t, true); - t = null; - } // log if (useLog4J) { - if (SYS_DEBUG != null) { - logger.setLevel(Level.DEBUG); - } - if (offSetInLogConfig) { - // Not printing anything - } else if (fatalSetInLogConfig && Level.FATAL.equals(levelObjs[level]) - || errorSetInLogConfig && Level.ERROR.equals(levelObjs[level]) - || warnSetInLogConfig && Level.WARN.equals(levelObjs[level]) - || infoSetInLogConfig && Level.INFO.equals(levelObjs[level]) - || debugSetInLogConfig && Level.DEBUG.equals(levelObjs[level]) - || traceSetInLogConfig && Level.DEBUG.equals(levelObjs[level])) { - logger.log(callingClass, levelObjs[level], msg, t); - } else if (allSetInLogConfig) { - logger.log(callingClass, Level.INFO, msg, t); - } else { - logger.log(callingClass, levelObjs[level], msg, t); - } + Logger logger = getLogger(module); + //callingClass + logger.log(levelObjs[level], msg, t); } else { StringBuilder prefixBuf = new StringBuilder(); @@ -276,7 +168,7 @@ public final class Debug { if (useLevelOnCache) { return levelOnCache[level]; } else { - return (level == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug", levelProps[level], "true")); + return (level == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", levelProps[level], "true")); } } @@ -481,26 +373,6 @@ public final class Debug { log(Debug.FATAL, t, msg, module, params); } - public static void logNotify(String msg, String module) { - log(Debug.NOTIFY, null, msg, module, emptyParams); - } - - public static void logNotify(String msg, String module, Object... params) { - log(Debug.NOTIFY, null, msg, module, params); - } - - public static void logNotify(Throwable t, String module) { - log(Debug.NOTIFY, t, null, module, emptyParams); - } - - public static void logNotify(Throwable t, String msg, String module) { - log(Debug.NOTIFY, t, msg, module, emptyParams); - } - - public static void logNotify(Throwable t, String msg, String module, Object... params) { - log(Debug.NOTIFY, t, msg, module, params); - } - public static void set(int level, boolean on) { if (!useLevelOnCache) return; @@ -512,72 +384,4 @@ public final class Debug { return true; return levelOnCache[level]; } - - public static synchronized Appender getNewFileAppender(String name, String logFile, long maxSize, int backupIdx, String pattern) { - if (pattern == null) { - pattern = "%-5r[%24F:%-3L:%-5p]%x %m%n"; - } - - PatternLayout layout = new PatternLayout(pattern); - layout.activateOptions(); - - RollingFileAppender newAppender = null; - try { - newAppender = new RollingFileAppender(layout, logFile, true); - } catch (IOException e) { - logFatal(e, Debug.class.getName()); - } - - if (newAppender != null) { - if (backupIdx > 0) { - newAppender.setMaxBackupIndex(backupIdx); - } - if (maxSize > 0) { - newAppender.setMaximumFileSize(maxSize); - } - newAppender.setThreshold(Level.DEBUG); - newAppender.activateOptions(); - newAppender.setName(name); - } - - return newAppender; - } - - public static boolean registerFileAppender(String module, String name, String logFile, long maxSize, int backupIdx, String pattern) { - Logger logger = Logger.getLogger(module); - boolean found = false; - - Appender foundAppender = logger.getAppender(name); - if (foundAppender == null) { - Enumeration<Logger> currentLoggerEnum = UtilGenerics.cast(Logger.getRootLogger().getLoggerRepository().getCurrentLoggers()); - while (currentLoggerEnum.hasMoreElements() && foundAppender == null) { - Logger log = currentLoggerEnum.nextElement(); - foundAppender = log.getAppender(name); - } - } else { - return true; - } - - if (foundAppender == null) { - if (logFile != null) { - foundAppender = getNewFileAppender(name, logFile, maxSize, backupIdx, pattern); - if (foundAppender != null) { - found = true; - } - } - } else { - found = true; - } - - logger.addAppender(foundAppender); - return found; - } - - public static boolean registerFileAppender(String module, String name, String logFile) { - return registerFileAppender(module, name, logFile, 0, 10, null); - } - - public static boolean registerFileAppender(String module, String name) { - return registerFileAppender(module, name, null, -1, -1, null); - } } Modified: ofbiz/trunk/framework/common/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/common/servicedef/services.xml (original) +++ ofbiz/trunk/framework/common/servicedef/services.xml Tue Aug 19 10:36:01 2014 @@ -86,13 +86,6 @@ under the License. <attribute name="timing" type="String" mode="IN" optional="true"/> <attribute name="verbose" type="String" mode="IN" optional="true"/> </service> - <service name="addOrUpdateLogger" engine="java" - location="org.ofbiz.common.CommonServices" invoke="addOrUpdateLogger" auth="true"> - <description>Add/Update logger in logging system</description> - <attribute name="name" type="String" mode="IN" optional="false"/> - <attribute name="level" type="String" mode="IN" optional="false"/> - <attribute name="additivity" type="String" mode="IN" optional="true"/> - </service> <service name="displayXaDebugInfo" engine="java" location="org.ofbiz.common.CommonServices" invoke="displayXaDebugInfo" auth="true"> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Tue Aug 19 10:36:01 2014 @@ -44,8 +44,6 @@ import javax.mail.internet.MimeMessage; import javolution.util.FastList; import javolution.util.FastMap; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.ofbiz.base.metrics.Metrics; import org.ofbiz.base.metrics.MetricsFactory; import org.ofbiz.base.util.Debug; @@ -220,23 +218,6 @@ public class CommonServices { return ServiceUtil.returnSuccess(); } - public static Map<String, Object> addOrUpdateLogger(DispatchContext dctc, Map<String, ?> context) { - String name = (String) context.get("name"); - String level = (String) context.get("level"); - boolean additivity = "Y".equalsIgnoreCase((String) context.get("additivity")); - - Logger logger = null; - if ("root".equals(name)) { - logger = Logger.getRootLogger(); - } else { - logger = Logger.getLogger(name); - } - logger.setLevel(Level.toLevel(level)); - logger.setAdditivity(additivity); - - return ServiceUtil.returnSuccess(); - } - public static Map<String, Object> forceGc(DispatchContext dctx, Map<String, ?> context) { System.gc(); return ServiceUtil.returnSuccess(); Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy Tue Aug 19 10:36:01 2014 @@ -16,39 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import java.util.Collections; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggerRepository; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.entity.util.EntityUtil; - - -rootLogger = Logger.getRootLogger(); -loggerRepository = rootLogger.getLoggerRepository(); - -loggerList = []; -for (Enumeration enumeration = loggerRepository.getCurrentLoggers(); enumeration.hasMoreElements();) { - logger = enumeration.nextElement(); - - if (logger.getLevel() != null) { - loggerMap = [name : logger.getName(), level : logger.getLevel(), additivity : logger.getAdditivity() ? "Y" : "N", logger : logger]; - loggerList.add(loggerMap); - } -} - -Collections.sort(loggerList, [compare: {l1, l2 -> l1.name.compareTo(l2.name)}] as Comparator); - -loggerList.add(0, [name : rootLogger.getName(), level : rootLogger.getLevel(), additivity : rootLogger.getAdditivity() ? "Y" : "N", logger : rootLogger]); -context.loggerList = loggerList; -context.defaultLogger = [name : "org.ofbiz.", level : "INFO", additivity : "Y"]; context.activeDebugLevel = [fatal : Debug.fatalOn() ? "Y" : "N", error : Debug.errorOn() ? "Y" : "N", warning : Debug.warningOn() ? "Y" : "N", Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Tue Aug 19 10:36:01 2014 @@ -244,16 +244,6 @@ under the License. <security https="true" auth="true"/> <response name="success" type="view" value="LogConfiguration"/> </request-map> - <request-map uri="AddLogger"> - <security https="true" auth="true"/> - <event type="service" invoke="addOrUpdateLogger"/> - <response name="success" type="view" value="LogConfiguration"/> - </request-map> - <request-map uri="UpdateLogger"> - <security https="true" auth="true"/> - <event type="service-multi" invoke="addOrUpdateLogger"/> - <response name="success" type="view" value="LogConfiguration"/> - </request-map> <request-map uri="AdjustDebugLevels"> <security https="true" auth="true"/> <event type="service" invoke="adjustDebugLevels"/> Modified: ofbiz/trunk/framework/webtools/widget/LogForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LogForms.xml?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/widget/LogForms.xml (original) +++ ofbiz/trunk/framework/webtools/widget/LogForms.xml Tue Aug 19 10:36:01 2014 @@ -32,43 +32,4 @@ under the License. <field name="submit" title="${uiLabelMap.CommonUpdate}"><submit/></field> </form> - <form name="AddLogger" type="single" default-map-name="defaultLogger" target="AddLogger" - header-row-style="header-row" default-table-style="basic-table"> - <field name="name" title="${uiLabelMap.WebtoolsLoggerName}"><text size="50"/></field> - <field name="level" title="${uiLabelMap.WebtoolsLoggerLevel}"> - <drop-down> - <option key="OFF"/> - <option key="FATAL"/> - <option key="ERROR"/> - <option key="WARN"/> - <option key="INFO"/> - <option key="TRACE"/> - <option key="DEBUG"/> - <option key="ALL"/> - </drop-down> - </field> - <field name="additivity" title="${uiLabelMap.WebtoolsLoggerAdditivity}"><check/></field> - <field name="submit" title="${uiLabelMap.CommonAdd}"><submit/></field> - </form> - - <form name="LoggerList" type="multi" target="UpdateLogger" list-name="loggerList" separate-columns="true" - paginate="false" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> - <field name="name" title="${uiLabelMap.WebtoolsLoggerName}"><display/></field> - <field name="level" title="${uiLabelMap.WebtoolsLoggerLevel}"> - <drop-down> - <option key="OFF"/> - <option key="FATAL"/> - <option key="ERROR"/> - <option key="WARN"/> - <option key="INFO"/> - <option key="TRACE"/> - <option key="DEBUG"/> - <option key="ALL"/> - </drop-down> - </field> - <field name="additivity" title="${uiLabelMap.WebtoolsLoggerAdditivity}"> - <check/> - </field> - <field name="submit" title="${uiLabelMap.CommonUpdate}"><submit/></field> - </form> </forms> Modified: ofbiz/trunk/framework/webtools/widget/LogScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LogScreens.xml?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/widget/LogScreens.xml (original) +++ ofbiz/trunk/framework/webtools/widget/LogScreens.xml Tue Aug 19 10:36:01 2014 @@ -87,12 +87,6 @@ under the License. <screenlet title="${uiLabelMap.WebtoolsDebuggingLevelFormDescription}"> <include-form name="LevelSwitch" location="component://webtools/widget/LogForms.xml"/> </screenlet> - <screenlet title="${uiLabelMap.WebtoolsAddLoggerFormDescription}"> - <include-form name="AddLogger" location="component://webtools/widget/LogForms.xml"/> - </screenlet> - <screenlet title="${uiLabelMap.WebtoolsLoggerListFormDescription}"> - <include-form name="LoggerList" location="component://webtools/widget/LogForms.xml"/> - </screenlet> </decorator-section> </decorator-screen> </widgets> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=1618831&r1=1618830&r2=1618831&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Tue Aug 19 10:36:01 2014 @@ -36,7 +36,6 @@ import net.xoetrope.xui.helper.SwingWork import org.ofbiz.accounting.payment.PaymentGatewayServices; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; -import org.ofbiz.base.util.Log4jLoggerWriter; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; @@ -96,7 +95,6 @@ public class PosTransaction implements S public static final int INTERNAL_PAYMENT = 1; public static final int EXTERNAL_PAYMENT = 2; - private static PrintWriter defaultPrintWriter = new Log4jLoggerWriter(Debug.getLogger(module)); private static PosTransaction currentTx = null; private static LifoSet<PosTransaction> savedTx = new LifoSet<PosTransaction>(); @@ -125,7 +123,7 @@ public class PosTransaction implements S this.session = session; this.terminalId = session.getId(); this.partyId = "_NA_"; - this.trace = defaultPrintWriter; + //this.trace = defaultPrintWriter; this.productStoreId = (String) session.getAttribute("productStoreId"); this.facilityId = (String) session.getAttribute("facilityId"); @@ -1195,6 +1193,7 @@ public class PosTransaction implements S } private void trace(String s1, String s2, Throwable t) { + /* if (trace != null) { String msg = s1; if (UtilValidate.isNotEmpty(s2)) { @@ -1208,6 +1207,7 @@ public class PosTransaction implements S trace.println("[POS @ " + terminalId + " TX:" + transactionId + "] - " + msg); trace.flush(); } + */ } public static synchronized PosTransaction getCurrentTx(XuiSession session) { |
Free forum by Nabble | Edit this page |