You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2013/06/04 16:48:45 UTC

svn commit: r1489461 - in /ofbiz/trunk/framework: base/config/log4j.xml webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy webtools/webapp/webtools/log/logContent.ftl webtools/widget/LogScreens.xml

Author: jacopoc
Date: Tue Jun  4 14:48:40 2013
New Revision: 1489461

URL: http://svn.apache.org/r1489461
Log:
The content rendered in the Webtools "view log" screen is now rendered from the ofbiz.log file rather then the ofbiz.html file in order to provide more control on the html code rendered in the screen.

Modified:
    ofbiz/trunk/framework/base/config/log4j.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy
    ofbiz/trunk/framework/webtools/webapp/webtools/log/logContent.ftl
    ofbiz/trunk/framework/webtools/widget/LogScreens.xml

Modified: ofbiz/trunk/framework/base/config/log4j.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/log4j.xml?rev=1489461&r1=1489460&r2=1489461&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/config/log4j.xml (original)
+++ ofbiz/trunk/framework/base/config/log4j.xml Tue Jun  4 14:48:40 2013
@@ -54,17 +54,6 @@
         </layout>
     </appender>
 
-    <!-- ofbiz web file appender -->
-    <appender name="ofbiz-html" class="org.apache.log4j.RollingFileAppender">
-        <param name="maxFileSize" value="500KB"/>
-        <param name="maxBackupIndex" value="1"/>
-        <param name="File" value="${ofbiz.home}/runtime/logs/ofbiz.html"/>
-        <param name="threshold" value="info"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="&lt;div class=&quot;%p&quot;&gt;%d (%t) [%24F:%-3L:%-5p]%x %m &lt;/div&gt;%n"/>
-        </layout>
-    </appender>
-
     <!-- debug log -->
     <appender name="debug" class="org.apache.log4j.RollingFileAppender">
         <param name="maxFileSize" value="10000KB"/>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy?rev=1489461&r1=1489460&r2=1489461&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy Tue Jun  4 14:48:40 2013
@@ -19,10 +19,23 @@
 
 import org.ofbiz.base.util.FileUtil;
 
-sb = null;
+List logLines = [];
 try {
-    sb = FileUtil.readTextFile(logFileName, true);
+    File logFile = FileUtil.getFile(logFileName);
+    logFile.eachLine { line ->
+        String ln = line;
+        type = '';
+        if (ln.contains(":INFO ] ")) {
+            type = 'INFO';
+        } else if (ln.contains(":WARN ] ")) {
+            type = 'WARN';
+        } else if (ln.contains(":ERROR] ")) {
+            type = 'ERROR';
+        } else if (ln.contains(":DEBUG] ")) {
+            type = 'DEBUG';
+        }
+        logLines.add([type: type, line:line]);
+    }
 } catch (Exception exc) {}
-if (sb) {
-    context.logFileContent = sb;
-}
+
+context.logLines = logLines;

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/log/logContent.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/log/logContent.ftl?rev=1489461&r1=1489460&r2=1489461&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/log/logContent.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/log/logContent.ftl Tue Jun  4 14:48:40 2013
@@ -17,4 +17,6 @@ specific language governing permissions 
 under the License.
 -->
 
-${logFileContent?if_exists}
+<#list logLines as logLine>
+  <div class="${logLine.type}">${logLine.line}</div>
+</#list>

Modified: ofbiz/trunk/framework/webtools/widget/LogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LogScreens.xml?rev=1489461&r1=1489460&r2=1489461&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/LogScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/LogScreens.xml Tue Jun  4 14:48:40 2013
@@ -106,7 +106,7 @@ under the License.
                  <set field="tabButtonItem" value="logView"/>
                  <!-- TODO: the following command is not really working (and the default value is always used);
                               my guess is that the base/config/debug.properties file is not found in the classpath -->
-                 <property-to-field resource="debug" property="log4j.appender.css.File" field="logFileName" default="runtime/logs/ofbiz.html" no-locale="true"/>
+                 <property-to-field resource="debug" property="log4j.appender.css.File" field="logFileName" default="runtime/logs/ofbiz.log" no-locale="true"/>
                  <script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy"/>
              </actions>
              <widgets>