You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/12/28 19:47:02 UTC
svn commit: r1426606 -
/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java
Author: jleroux
Date: Fri Dec 28 18:47:02 2012
New Revision: 1426606
URL: http://svn.apache.org/viewvc?rev=1426606&view=rev
Log:
No functional changes
I tried to use the non useLog4J branch and localised it to show more like how useLog4J renders. But I found some issues with (time was not in sync useLog4J when I used both) and finally did not use it. So it's only the l10n part
I also added a convenient get()
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java
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=1426606&r1=1426605&r2=1426606&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 Fri Dec 28 18:47:02 2012
@@ -21,19 +21,22 @@ package org.ofbiz.base.util;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
-import java.text.DateFormat;
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.Appender;
import org.apache.log4j.spi.LoggerRepository;
+import org.ofbiz.base.conversion.ConversionException;
+import org.ofbiz.base.conversion.DateTimeConverters.DateToString;
/**
* Configurable Debug logging wrapper class
@@ -60,8 +63,6 @@ public final class Debug {
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};
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
-
protected static Map<String, Integer> levelStringMap = new HashMap<String, Integer>();
protected static PrintStream printStream = System.out;
@@ -183,7 +184,13 @@ public final class Debug {
} else {
StringBuilder prefixBuf = new StringBuilder();
- prefixBuf.append(dateFormat.format(new java.util.Date()));
+ DateToString dateToString = new DateToString();
+ try {
+ prefixBuf.append(dateToString.convert(new java.util.Date(), Locale.getDefault(),
+ TimeZone.getDefault(), UtilDateTime.DATE_TIME_FORMAT));
+ } catch (ConversionException e) {
+ logFatal(e, Debug.class.getName());
+ }
prefixBuf.append(" [OFBiz");
if (module != null) {
prefixBuf.append(":");
@@ -440,6 +447,12 @@ public final class Debug {
levelOnCache[level] = on;
}
+ public static boolean get(int level) {
+ if (!useLevelOnCache)
+ 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";