Server side logging issue - how to get source class and method ?

13 views
Skip to first unread message

tomekc

unread,
Dec 22, 2009, 5:26:48 PM12/22/09
to gwt-log
Hello,

I have standard gae/j + gwt project. On client side I use gwt-log
framework which works great. On server side worked default logger from
java api. Now I would like to use also gwt-log to logs events.
When I compile servlet with e.g. Log.info("some info"); I get:

2009-12-22 22:15:16 com.allen_sauer.gwt.log.server.ServerLogImplJDK14
info
INFO: info

I don't have information from which my class/method event was thrown.
com.allen_sauer.gwt.log.server.ServerLogImplJDK14 is certainly logger
class...

Is there a way to get really event's source ?

Regards,tomek.

Fred Sauer

unread,
Dec 23, 2009, 7:39:37 PM12/23/09
to gwt...@googlegroups.com
If you include the log4j jar on the server classpath, then you configure log4j.properties or log4j.xml to include line number information.



--

You received this message because you are subscribed to the Google Groups "gwt-log" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-log+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-log?hl=en.





--
Fred Sauer
Developer Advocate
Google Inc.1600 Amphitheatre Parkway
Mountain View, CA 94043
fre...@google.com


Rob Tanner

unread,
Jan 20, 2010, 5:14:39 PM1/20/10
to gwt-log
Fred,

Logging is still not working for me.

I modified my MyApp.gwt.xml file to include the following:

<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
  <extend-property name="log_level" values="INFO,WARN,ERROR"/>
<set-property name="log_RemoteLogger" value="ENABLED" />
<set-property name="log_WindowLogger" value="ENABLED" />

And I modified web.xml to include the following:

<servlet>
<servlet-name>gwt-log-remote-logger-servlet</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>
<url-pattern>/myapp/gwt-log</url-pattern>
</servlet-mapping>

In the class that implements EntryPoint if have a couple of Log.info
(msg) statements to log just test text to see what happens and in one
of the classes that it instantiates, I have a Log.info(msg) that has
similar test text just to see what happens.

Hosted mode does not generate any errors and in the console in Eclipse
I get the following:
============= gwt-log-2.6.2 =============Wed Jan 20 13:51:39 PST
2010=============


And that's it. Nothing else on the console or logged on the server
(using log4j). What am I missing? Any suggestions?

-- Rob


On Dec 23 2009, 4:39 pm, Fred Sauer <fre...@gmail.com> wrote:
> If you include the log4j jar on the server classpath, then you configure
> log4j.properties or log4j.xml to include line number information.
>
>
>
>
>
> On Tue, Dec 22, 2009 at 2:26 PM, tomekc <to...@ceszke.com> wrote:
> > Hello,
>
> > I have standard gae/j + gwt project. On client side I use gwt-log
> > framework which works great. On server side worked default logger from
> > java api. Now I would like to use also gwt-log to logs events.
> > When I compile servlet with e.g. Log.info("some info"); I get:
>
> > 2009-12-22 22:15:16 com.allen_sauer.gwt.log.server.ServerLogImplJDK14
> > info
> > INFO: info
>
> > I don't have information from which my class/method  event was thrown.
> > com.allen_sauer.gwt.log.server.ServerLogImplJDK14 is certainly logger
> > class...
>
> > Is there a way to get really event's source ?
>
> > Regards,tomek.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "gwt-log" group.
> > To post to this group, send email to gwt...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > gwt-log+u...@googlegroups.com<gwt-log%2Bunsu...@googlegroups.com >

Fred Sauer

unread,
Jan 20, 2010, 5:29:22 PM1/20/10
to gwt...@googlegroups.com
Rob,

That all looks fine. Should absolutely work.

Add a Window.alert('test') after the log statements to make sure the code is executing without exceptions

Fred


To unsubscribe from this group, send email to gwt-log+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gwt-log?hl=en.



Rob Tanner

unread,
Jan 20, 2010, 6:20:29 PM1/20/10
to gwt-log
Fred,

I presume the theory here is that if an exception gets thrown prior to
the alert box I won't see the alert box. However, I do see the alert
box and all stops (i.e., the page just hangs there incomplete) until I
click OK to close the alert box which is what I would expect. So,
based on that, no exceptions are being thrown.

-- Rob

> > <gwt-log%2Bunsu...@googlegroups.com<gwt-log%252Bunsubscribe@googlegroup s.com>>

Rob Tanner

unread,
Jan 20, 2010, 6:30:18 PM1/20/10
to gwt-log
Fred,

Look at my 2:14 post for my settings. The Log.info(msg) statements
aren't logging a thing but when I change one of them to Log.error
(msg), the message text gets logged. I also tried Log.warn(msg) and
got nothing. I'm specifying (I think) info, warn and error, so why
does Log.error(msg) generate a log?

-- Rob

Fred Sauer

unread,
Jan 25, 2010, 12:06:34 AM1/25/10
to gwt...@googlegroups.com
Ah, perhaps we've crossed messages here.

Hope this helps:
  • The gwt-log configuration in your .gwt.xml only controls the log level as it is logged on the client side and whether or not to forward logged messages to the server
  • The server may have its own (more restrictive) log level which prevent some messages from being displayed
  • java.util.logging by default logs less than log4j does
  • When in development mode (hosted mode) the SystemLogger will log messages to the console directly from the client. However in production mode (web mode) no such console exists and only server console output will log anything
It sounds like you're looking at the server console and that more severe message are being logged. That means the logging infrastructure/code works. It's just a matter of getting the server side log level configured. How you do this depends on whether you're using log4j, stdio or the default java.util.logging.

Fred


To unsubscribe from this group, send email to gwt-log+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gwt-log?hl=en.



Reply all
Reply to author
Forward
0 new messages