Hi Fred,
thank you for the quick reply.
Its working fine now.
Here is my configuration (for others out there):
Project structure:
myProject
-src
-myproject
-myproject.gwt.xml
-meta-inf
-log4j.xml
-log4j.dtd
-test
-war
- WEB-INF
-lib
-...
-log4j-1.2.15.jar (in eclipse add this two also
to classpath as
libraries)
-gwt-log-3.0.1.jar
-logging.properties
-web.xml
In myproject.gwt.xml:
...
<!-- gwt-log parameters************* START -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
<!--Utilizes System.err and System.out. -->
<set-property name="log_SystemLogger" value="ENABLED" />
<!-- Sends copies of client log messages to the server via RPC. -->
<set-property name="log_RemoteLogger" value="ENABLED" />
<!-- gwt-log parameters************** END -->
<<<<<<<<<log4j.xml>>>>>>>>>>>>>>>>>>>>>>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}
[%-5p][%c{1}] %m
%n" />
</layout>
</appender>
<appender name="util" class="org.apache.log4j.FileAppender">
<param name="File" value="temp.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}
[%-5p][%c{1}] %m
%n" />
</layout>
</appender>
<root>
<priority value="TRACE" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="util" />
</root>
</log4j:configuration>
You need also the log4j.dtd, just google and download it.
In my case I had to remove the logging.properties from web.xml and
add gwt-log parameters,
so it looks like this:
...
<servlet>
<servlet-name>remoteLoggerServiceImpl</servlet-name>
<servlet-
class>com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
<!-- servlet-name>gwt-log-remote-logger-servlet</servlet-name-->
<servlet-name>remoteLoggerServiceImpl</servlet-name>
<url-pattern>/pageflipgwt/gwt-log</url-pattern>
</servlet-mapping>
</web-app>
Thats all you should need.
Now you can write messages, no matter if you are on client or server
side,
into a file (configured in log4j.xml) like this:
Log.trace("This is a 'TRACE' test message");
Log.debug("This is a 'DEBUG' test message");
Log.info("This is a 'INFO' test message");
Log.warn("This is a 'WARN' test message");
Log.error("This is a 'ERROR' test message");
Log.fatal("This is a 'FATAL' test message");
Kind regards,
alex
--
You received this message because you are subscribed to the Google Groups
"gwt-log" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/gwt-log?hl=en.