You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ar...@apache.org on 2016/05/31 05:26:44 UTC

svn commit: r1746227 - in /ofbiz/trunk/framework: common/config/ webtools/config/ webtools/template/log/ webtools/webapp/webtools/WEB-INF/ webtools/webapp/webtools/WEB-INF/actions/log/ webtools/widget/

Author: arunpatidar
Date: Tue May 31 05:26:43 2016
New Revision: 1746227

URL: http://svn.apache.org/viewvc?rev=1746227&view=rev
Log:
[OFBIZ-7140] Added Fetch Log Functionality parallel to View Log in webtools. Thanks Rishi Solanki for new feature and patch.

Added:
    ofbiz/trunk/framework/webtools/template/log/FetchLogs.ftl
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy
Modified:
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
    ofbiz/trunk/framework/webtools/widget/LogScreens.xml
    ofbiz/trunk/framework/webtools/widget/Menus.xml

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1746227&r1=1746226&r2=1746227&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Tue May 31 05:26:43 2016
@@ -10232,6 +10232,9 @@
         <value xml:lang="zh-CN">任何</value>
         <value xml:lang="zh-TW">任何</value>
     </property>
+    <property key="CommonSelectFile">
+        <value xml:lang="en">Select File</value>
+    </property>
     <property key="CommonSelectOne">
         <value xml:lang="ar">إختر واحد</value>
         <value xml:lang="cs">Vyberte jeden</value>

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1746227&r1=1746226&r2=1746227&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Tue May 31 05:26:43 2016
@@ -579,6 +579,9 @@
         <value xml:lang="zh">实体同步状态</value>
         <value xml:lang="zh-TW">資料實體同步狀態</value>
     </property>
+    <property key="PageTitleFetchLogs">
+        <value xml:lang="en">Fetch Logs</value>
+    </property>
     <property key="PageTitleFindJob">
         <value xml:lang="de">Job suchen</value>
         <value xml:lang="en">Find Job</value>
@@ -2224,6 +2227,9 @@
         <value xml:lang="zh">严重错误级别会指出那些可能导致应用程序异常中断的严重错误事件。</value>
         <value xml:lang="zh-TW">嚴重錯誤級別會指出那些可能導致應用程式異常中斷的嚴重錯誤事件.</value>
     </property>
+    <property key="WebtoolsFetchLogs">
+        <value xml:lang="en">Fetch Logs</value>
+    </property>
     <property key="WebtoolsFieldName">
         <value xml:lang="de">Feldname</value>
         <value xml:lang="en">Field Name</value>
@@ -4610,6 +4616,9 @@
         <value xml:lang="zh">任务计划</value>
         <value xml:lang="zh-TW">任務計劃</value>
     </property>
+    <property key="WebtoolsSearchString">
+        <value xml:lang="en">Search String</value>
+    </property>
     <property key="WebtoolsSecasIgnoreError">
         <value xml:lang="de">Fehler ignorieren</value>
         <value xml:lang="en">Ignore Error</value>

Added: ofbiz/trunk/framework/webtools/template/log/FetchLogs.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/template/log/FetchLogs.ftl?rev=1746227&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/template/log/FetchLogs.ftl (added)
+++ ofbiz/trunk/framework/webtools/template/log/FetchLogs.ftl Tue May 31 05:26:43 2016
@@ -0,0 +1,50 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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.
+-->
+
+<div class="page-title"><span>${uiLabelMap.WebtoolsFetchLogs}</span></div>
+<div>
+  <form name="fetchLogs" method="post" action="<@o...@ofbizUrl>">
+    <fieldset>
+      <span>
+        <label for="logFileName">${uiLabelMap.CommonSelectFile}: </label>
+        <select name="logFileName">
+          <option value="">${uiLabelMap.CommonSelectFile}</option>
+          <#if parameters.logFileName?has_content>
+            <option selected value="${parameters.logFileName}">${parameters.logFileName}</option>
+          </#if>
+          <#if listLogFileNames?has_content>
+            <#list listLogFileNames as logFileName>
+              <option value="${logFileName}">${logFileName}</option>
+            </#list>
+          </#if>
+        </select>
+      </span>
+      <span>
+        <label for="searchString">${uiLabelMap.WebtoolsSearchString}: </label>
+        <input name="searchString" class="required" type="text" value="${parameters.searchString!}" />
+      </span>
+    </fieldset>
+    <input type="submit" value="${uiLabelMap.CommonSubmit}" />
+  </form>
+</div>
+<#if logLines?has_content>
+  <#list logLines as logLine>
+    <div class="${logLine.type}">${logLine.line}</div>
+  </#list>
+</#if>
\ No newline at end of file

Added: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy?rev=1746227&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy (added)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy Tue May 31 05:26:43 2016
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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;
+
+ofbizHomeStr = System.getProperty("ofbiz.home");
+ofbizHomeStr = ofbizHomeStr + "/runtime/logs/";
+File runTimeLogDir = FileUtil.getFile(ofbizHomeStr);
+File[] listLogFiles = runTimeLogDir.listFiles(); 
+List listLogFileNames = []
+for (int i = 0; i < listLogFiles.length; i++) {
+    if (listLogFiles[i].isFile()) {
+        logFileName = listLogFiles[i].getName();
+        if (logFileName.startsWith("ofbiz")) {
+            listLogFileNames.add(logFileName);
+        }
+    }
+}
+context.listLogFileNames = listLogFileNames;
+
+if (parameters.logFileName) {
+    logFileName = ofbizHomeStr + parameters.logFileName;
+    List logLines = [];
+    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';
+        }
+        if (parameters.searchString) {
+            if (line.contains(parameters.searchString)) {
+                logLines.add([type: type, line:line]);
+            }
+        } else {
+            logLines.add([type: type, line:line]);
+        }
+    }
+    context.logLines = logLines;
+}
\ No newline at end of file

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=1746227&r1=1746226&r2=1746227&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Tue May 31 05:26:43 2016
@@ -253,6 +253,10 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="LogView"/>
     </request-map>
+    <request-map uri="FetchLogs">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="FetchLogs"/>
+    </request-map>
 
     <!-- Service Engine Info and Job Management Requests -->
     <request-map uri="ServiceLog">
@@ -600,6 +604,7 @@ under the License.
 
     <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="FetchLogs" type="screen" page="component://webtools/widget/LogScreens.xml#FetchLogs"/>
 
     <view-map name="StatsSinceStart" type="screen" page="component://webtools/widget/StatsScreens.xml#StatsSinceStart"/>
     <view-map name="StatBinsHistory" type="screen" page="component://webtools/widget/StatsScreens.xml#StatBinsHistory"/>

Modified: ofbiz/trunk/framework/webtools/widget/LogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LogScreens.xml?rev=1746227&r1=1746226&r2=1746227&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/LogScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/LogScreens.xml Tue May 31 05:26:43 2016
@@ -123,4 +123,26 @@ under the License.
              </widgets>
          </section>
      </screen>
+
+     <screen name="FetchLogs">
+         <section>
+             <actions>
+                 <set field="titleProperty" value="PageTitleFetchLogs"/>
+                 <set field="tabButtonItem" value="fetchLogs"/>
+                 <script location="component://webtools/webapp/webtools/WEB-INF/actions/log/FetchLogs.groovy"/>
+             </actions>
+             <widgets>
+                 <decorator-screen name="log-decorator">
+                     <decorator-section name="body">
+                         <screenlet>
+                             <platform-specific>
+                                 <html><html-template location="component://webtools/template/log/FetchLogs.ftl"/></html>
+                             </platform-specific>
+                         </screenlet>
+                     </decorator-section>
+                 </decorator-screen>
+             </widgets>
+         </section>
+     </screen>
+
  </screens>

Modified: ofbiz/trunk/framework/webtools/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/Menus.xml?rev=1746227&r1=1746226&r2=1746227&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/Menus.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/Menus.xml Tue May 31 05:26:43 2016
@@ -127,6 +127,9 @@ under the License.
         <menu-item name="logView" title="${uiLabelMap.WebtoolsViewLog}">
             <link target="LogView"/>
         </menu-item>
+        <menu-item name="fetchLogs" title="${uiLabelMap.WebtoolsFetchLogs}">
+            <link target="FetchLogs"/>
+        </menu-item>
         <menu-item name="serviceLog" title="${uiLabelMap.WebtoolsServiceLog}">
             <link target="ServiceLog"/>
         </menu-item>