svn commit: r462762 - in /incubator/ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/actions/log/LogView.bsh webapp/webtools/WEB-INF/controller.xml widget/LogScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r462762 - in /incubator/ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/actions/log/LogView.bsh webapp/webtools/WEB-INF/controller.xml widget/LogScreens.xml

jacopoc
Author: jacopoc
Date: Wed Oct 11 03:51:06 2006
New Revision: 462762

URL: http://svn.apache.org/viewvc?view=rev&rev=462762
Log:
Implemented a new WebTools screen to view the content of the ofbiz log file.
It is a tool that will need a few refinements but I think it is also really useful as it is now.

Added:
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh   (with props)
Modified:
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
    incubator/ofbiz/trunk/framework/webtools/widget/LogScreens.xml

Added: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh?view=auto&rev=462762
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh (added)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh Wed Oct 11 03:51:06 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2001-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.FileUtil;
+
+StringBuffer sb = null;
+try {
+    sb = FileUtil.readTextFile(logFileName, true);
+} catch(Exception exc) {}
+if (sb != null) {
+    context.put("logFileContent", sb.toString().replaceAll(System.getProperty("line.separator"), "<br/>"));
+}

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?view=diff&rev=462762&r1=462761&r2=462762
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Wed Oct 11 03:51:06 2006
@@ -310,6 +310,10 @@
         <event type="service" invoke="adjustDebugLevels"/>
         <response name="success" type="view" value="LogConfiguration"/>
     </request-map>
+    <request-map uri="LogView">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="LogView"/>
+    </request-map>
 
     <request-map uri="serviceList">
         <security https="true" auth="true"/>
@@ -529,6 +533,7 @@
     <view-map name="readxpdl" type="region"/>
     <view-map name="workflowMonitor" type="region"/>
     <view-map name="LogConfiguration" type="screen" page="component://webtools/widget/LogScreens.xml#LogConfiguration"/>
+    <view-map name="LogView" type="screen" page="component://webtools/widget/LogScreens.xml#LogView"/>
 
     <view-map name="StatsSinceStart" type="region"/>
     <view-map name="StatBinsHistory" type="region"/>

Modified: incubator/ofbiz/trunk/framework/webtools/widget/LogScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/widget/LogScreens.xml?view=diff&rev=462762&r1=462761&r2=462762
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/widget/LogScreens.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/widget/LogScreens.xml Wed Oct 11 03:51:06 2006
@@ -27,6 +27,9 @@
       <widgets>
         <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
           <decorator-section name="body">
+              <container>
+                  <link target="LogView" text="View Log" style="buttontext"/>
+              </container>
               <container style="boxoutside">
                 <container style="boxtop">
                   <label style="boxhead">${uiLabelMap.WebtoolsDebuggingLevelFormDescription}</label>
@@ -53,6 +56,36 @@
                   <include-form name="LoggerList" location="component://webtools/webapp/webtools/log/LogForms.xml"/>
                 </container>
               </container>
+          </decorator-section>
+        </decorator-screen>
+      </widgets>
+    </section>
+  </screen>
+  <screen name="LogView">
+    <section>
+      <actions>
+        <set field="titleProperty" value="PageTitleLogView"/>
+        <!-- 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="debug.log4j.appender.file.File" field="logFileName" default="framework/logs/ofbiz.log" no-locale="true"/>
+        <script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh"/>
+      </actions>
+      <widgets>
+        <decorator-screen name="CommonWebtoolsDecorator" location="${parameters.mainDecoratorLocation}">
+          <decorator-section name="body">
+            <container>
+                <label style="head1">Log View</label>
+            </container>
+            <container>
+                <link target="LogConfiguration" text="Adjust Debugging Levels" style="buttontext"/>
+            </container>
+            <container>
+                <label style="tableheadtext">Log File Name:</label>
+                <label style="tabletext">${logFileName}</label>
+            </container>
+            <container>
+                <label style="tabletext">${logFileContent}</label>
+            </container>
           </decorator-section>
         </decorator-screen>
       </widgets>