2011-06-20 16 views
3

ログメッセージを書き込むためにGWT-logを使用しています。今のところ、私はコンソールのログを見ることができますし、catalinaファイル(私のtomcat内)でログを特定のファイル(私が定義します)に書きたいと思っています。どうやってやるの?GWT-log特定のファイルに書き込む方法は?

私が使用していますGWTのromote-ログ:私のweb.xmlの

<inherits name="com.google.gwt.logging.Logging"/> <set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />

<servlet> 
    <servlet-name>remoteLogging</servlet-name> 
    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>  
</servlet> 
<servlet-mapping> 
    <servlet-name>remoteLogging</servlet-name> 
    <url-pattern>/MyModule/remote_logging</url-pattern> 
</servlet-mapping> 
+0

このすべてが必要とは、自分のファイルを指すようにweb.configファイルリモートロギングサーブレットを変えたのか? – RAS

答えて

2

私は、ファイルへの書き込みに設定logging.propertiesを試してみましたが、運がなかったです。

<servlet> 
    <servlet-name>remoteLoggingServlet</servlet-name> 
    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class> 
    <init-param> 
     <param-name>java.util.logging.config.file</param-name> 
     <param-value>/WEB-INF/classes/logging.properties</param-value> 
    </init-param> 
</servlet> 

<servlet-mapping> 
    <servlet-name>remoteLoggingServlet</servlet-name> 
    <url-pattern>/my.app.path/remote_logging</url-pattern> 
</servlet-mapping> 

も成功せず、同様に私のプロジェクトのルートに設定してみました。 これは、java.util.logging.FileHandlerがエミュレートされたクラスの中にないためです。

http://code.google.com/intl/es-ES/webtoolkit/doc/latest/DevGuideLogging.html#Emulated_And_Non_Emulated

これは、恥はとても近づくことができるようにすることが、生産にこれらのタイプのエラーを追跡することはできません。カバーの下に、リモートロギングサービスがちょうどバニラのjava.util.loggingを使用するように見えることから、しかし、私には意味がありません

http://www.google.com/codesearch#A1edwVHBClQ/user/src/com/google/gwt/logging/server/RemoteLoggingServiceUtil.java&is_navigation=1

------- --Update ------------

RemoteLoggingServiceUtilクラスとRemoteLoggingServiceImplクラスを自分で実装し、代わりにlog4jを使用するようにしました。

これで問題は完全に解決されました。これで、サーバー側のログに記録するように設定できます。

これはGWTのログに固有のことがありますが、java.util.Loggingを設定する経験がないかもしれませんが、これはlog4jをプロジェクトのどこでも他の場所に使用しているので、はるかにクリーンです。単一のログファイル。あなたはどのエディタを使用しているを教えてもらえます

<servlet> 
    <servlet-name>remoteLoggingServlet</servlet-name> 
    <servlet-class>my.class.path.RemoteLoggingServiceImpl</servlet-class> 
</servlet> 

<servlet-mapping> 
    <servlet-name>remoteLoggingServlet</servlet-name> 
    <url-pattern>/edu.wisc.nelson.wolfhuntingsimulator.WolfHuntingSimulator/remote_logging</url-pattern> 
</servlet-mapping> 
関連する問題