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/05 11:57:29 UTC

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

Author: jacopoc
Date: Wed Jun  5 09:57:29 2013
New Revision: 1489784

URL: http://svn.apache.org/r1489784
Log:
Applied fix from trunk for revision: 1489461 
===

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/branches/release10.04/   (props changed)
    ofbiz/branches/release10.04/framework/base/config/log4j.xml
    ofbiz/branches/release10.04/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy
    ofbiz/branches/release10.04/framework/webtools/webapp/webtools/log/logContent.ftl
    ofbiz/branches/release10.04/framework/webtools/widget/LogScreens.xml

Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1489461

Modified: ofbiz/branches/release10.04/framework/base/config/log4j.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/base/config/log4j.xml?rev=1489784&r1=1489783&r2=1489784&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/base/config/log4j.xml (original)
+++ ofbiz/branches/release10.04/framework/base/config/log4j.xml Wed Jun  5 09:57:29 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="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/branches/release10.04/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy?rev=1489784&r1=1489783&r2=1489784&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy (original)
+++ ofbiz/branches/release10.04/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy Wed Jun  5 09:57:29 2013
@@ -19,10 +19,22 @@
 
 import org.ofbiz.base.util.FileUtil;
 
-sb = null;
+List logLines = [];
 try {
-    sb = FileUtil.readTextFile(logFileName, true);
+    File logFile = FileUtil.getFile(logFileName);
+    logFile.eachLine { line ->
+        type = '';
+        if (line.contains(":INFO ] ")) {
+            type = 'INFO';
+        } else if (line.contains(":WARN ] ")) {
+            type = 'WARN';
+        } else if (line.contains(":ERROR] ")) {
+            type = 'ERROR';
+        } else if (line.contains(":DEBUG] ")) {
+            type = 'DEBUG';
+        }
+        logLines.add([type: type, line:line]);
+    }
 } catch (Exception exc) {}
-if (sb) {
-    context.logFileContent = sb;
-}
+
+context.logLines = logLines;

Modified: ofbiz/branches/release10.04/framework/webtools/webapp/webtools/log/logContent.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/webtools/webapp/webtools/log/logContent.ftl?rev=1489784&r1=1489783&r2=1489784&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/webtools/webapp/webtools/log/logContent.ftl (original)
+++ ofbiz/branches/release10.04/framework/webtools/webapp/webtools/log/logContent.ftl Wed Jun  5 09:57:29 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/branches/release10.04/framework/webtools/widget/LogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/webtools/widget/LogScreens.xml?rev=1489784&r1=1489783&r2=1489784&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/webtools/widget/LogScreens.xml (original)
+++ ofbiz/branches/release10.04/framework/webtools/widget/LogScreens.xml Wed Jun  5 09:57:29 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>