2014-08-29 74 views
0

我們有要求監視我們的應用程序的性能。我發現鏈接A ZK Performance Monitor,但我無法配置此。其實我想在我的應用程序與slf4j記錄器配置性能監視。任何人都可以共享步驟來配置(zk 7.0.1)ZK性能監視器

我想爲這種情況創建CommandPhaseListener。但我不確定在我們的應用程序中實現CommandPhaseListener類以跟蹤性能。實際上,我們希望監視性能在slf4j記錄器中。

package support.mvvm; 

import org.zkoss.bind.*; 
import org.zkoss.zk.ui.Executions; 

public class CommandPhaseListener implements PhaseListener { 

    @Override 
    public void prePhase(Phase phase, BindContext ctx) { 
     if (phase== Phase.COMMAND){ 
      Executions.getCurrent().setAttribute("command", ctx.getCommandName()); 
      System.out.println(ctx.getCommandName()); 
     } 
    } 

    @Override 
    public void postPhase(Phase phase, BindContext ctx) { 

    } 

} 

感謝

+0

你有什麼迄今所做?你的代碼中有哪些不起作用? – AlexGreg 2014-08-29 11:42:58

+0

@AlexGreg我編輯自己的帖子請看這裏 – user3062776 2014-08-29 13:08:52

+0

@chillworld – user3062776 2014-08-29 13:13:46

回答

1

我猜你沒有登記在zk.xml內監聽器:

<zk> 
    <library-property> 
     <name>org.zkoss.bind.PhaseListener.class</name> 
     <value>support.mvvm.CommandPhaseListener</value> 
    </library-property> 
</zk> 
+0

可以請您給我配置SLF4J監視器的步驟 – user3062776 2014-08-29 13:23:52

+0

你可以看看http://stackoverflow.com/a/8277919/3548826 – AlexGreg 2014-08-29 13:26:21