Just include both gwt-log and log4j jars on the server classpath, then  
use the familiar Log.debug(...) style methods. Server side these  
messages will be redirected to log4j automatically.

Fred

On 10/21/08, Dhivya <[EMAIL PROTECTED]> wrote:
>
> Fred,
>
> We have started using gwt-log on the client side
> Can you post sample code of how gwt-log will work with log4j on the
> server  side.
>
> Thanks,
> Dhivya
>
>
>
> On Sep 11, 11:08 am, [EMAIL PROTECTED] wrote:
>> Sunil
>>
>> There is a hierarchy. I would compile trace and error levels. Use the
>> gwt meta property and URL parameter as you suggested.
>>
>> Compiling more levels cause longer compilation time. Compiling at a
>> lower level caused less code to be excluded in the output and also
>> introduces some overhead.
>>
>> Fred
>> On 9/11/08, Sunil <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> Thanks for the response. I was assuming that there is a level
>>> hierarchy for compile settings, i.e., that since I compiled for  
>>> DEBUG,
>>> then INFO/WARN/FATAL/ERROR are enabled which doesn't seem to be the
>>> case.
>>
>>> In my scenario, I want to be able to log ERROR and FATAL in
>>> production, but have the option to see all levels if necessary while
>>> debugging. So here's what I might need to do.
>>
>>> - In the module.xml, compile all levels
>>> <inherits name="com.allen_sauer.gwt.log.gwt-log-OFF" />
>>> <extend-property name="log_level" values="TRACE, DEBUG, INFO, WARN,
>>> ERROR, FATAL"/>
>>
>>> - In the host file
>>> <meta name="gwt:property" content="log_level=ERROR">
>>> Assuming that this will also log both ERROR and FATAL.
>>
>>> - If I then need to debug, I can use the URL parameter  
>>> log_level=DEBUG
>>
>>> Is there a runtime overhead to compiling all levels, and by default
>>> setting log_level to ERROR in the host file?
>>
>>> Thanks
>>> Sunil.
>>
>>> On Sep 9, 10:15 pm, "Fred Sauer" <[EMAIL PROTECTED]> wrote:
>>>> Sunil,
>>>> Since you're compiling with OFF and DEBUG compile time log levels  
>>>> in
>>>> your
>>>> *.gwt.xml file, INFO is not a valid *compile time* log level to  
>>>> pass in
>>>> the
>>>> URL, and it is getting ignored. Instead it is using the default  
>>>> 'OFF'.
>>
>>>> I think what you want to do is use DEBUG level in the URL, and  
>>>> then in
>>>> your
>>>> code call Log.setCurrentLogLevel(Log.LOG_LEVEL_INFO). This way  
>>>> you will
>>>> only
>>>> see INFO level messages, although the compiled application is  
>>>> able to
>>>> disable DEBUG level ones if you change the current runtime log  
>>>> level.
>>
>>>> Fred Sauer
>>>> [EMAIL PROTECTED]
>>
>>>> On Tue, Sep 9, 2008 at 12:03 PM, Sunil <[EMAIL PROTECTED]> wrote:
>>
>>>>> On Sep 5, 9:56 pm, "Fred Sauer" <[EMAIL PROTECTED]> wrote:
>>>>>> Sunil,
>>
>>>>>> If you compile with OFF, isLoggingEnabled() will always return
>>>>>> false.
>>
>>>>>> If you compile at any other level, then:
>>>>>> - if the current (runtime) log level is OFF, isLoggingEnabled()
>>>>>> will
>>>>> return
>>>>>> false
>>>>>> - if the current (runtime) log level is any other value,
>>>>> isLoggingEnabled()
>>>>>> will return true
>>
>>>>>> In your case (compiled level = DEBUG and runtime level = INFO),
>>>>>> isLoggingEnabled() will return true.'
>>
>>>>> That's not what I am seeing.
>>
>>>>> The compiled level is DEBUG and OFF, since I have the following  
>>>>> code
>>>>> in my module.xml
>>>>> <inherits name="com.allen_sauer.gwt.log.gwt-log-OFF"/>
>>>>> <extend-property name="log_level" values="DEBUG"/>
>>
>>>>> Then if I launch the GWT with a URL parameter of log_level=DEBUG,
>>>>> Log.isLoggingEnabled returns true.
>>>>> If I launch with a URL parameter of log_level=INFO, the impl  
>>>>> object
>>>>> in
>>>>> Log class is of type LogImplOff, which returns false. I am  
>>>>> presuming
>>>>> that since INFO is a lower level than DEBUG which has been  
>>>>> compiled,
>>>>> it should be enabled.
>>
>>>>> Thanks
>>>>> Sunil.
>>
>>>>>> Fred Sauer
>>>>>> [EMAIL PROTECTED]
>>
>>>>>> On Fri, Sep 5, 2008 at 8:00 AM, Sunil <[EMAIL PROTECTED]> wrote:
>>
>>>>>>> On Sep 4, 9:01 pm, "Fred Sauer" <[EMAIL PROTECTED]> wrote:
>>>>>>>> Sunil,
>>
>>>>>>>> Fred Sauer
>>>>>>>> [EMAIL PROTECTED]
>>
>>>>>>>> On Thu, Sep 4, 2008 at 2:34 PM, Sunil <[EMAIL PROTECTED]>
>>>>>>>> wrote:
>>
>>>>>>>>> Excellent tool.
>>
>>>>>>>> Thanks
>>
>>>>>>>> - Which loggers are enabled by default, and which are not? I
>>>>>>>> noticed
>>
>>>>>>>>> that the WindowLogger is not enabled by default. It would be
>>>>>>>>> great
>>>>> to
>>>>>>>>> add this to the documentation.
>>
>>>>>>>> I added a note about the WindowLogger to the getting started
>>>>>>>> wiki:
>>>>>>>>   http://code.google.com/p/gwt-log/wiki/GettingStarted
>>
>>>>>>>> Also added a note showing which loggers are activate by
>>>>>>>> default.
>>
>>>>>>> That's great. Thanks for the quick response.
>>
>>>>>>>> - The Log.isLoggingEnabled method, returns true only if the
>>>>>>>> log_level
>>
>>>>>>>>> is DEBUG. I would have expected it to return true even if
>>>>>>>>> ERROR
>>>>>>>>> is
>>>>>>>>> enabled for instance. Is there any method which can check if
>>>>> logging
>>>>>>>>> is enabled in general at runtime or not?
>>
>>>>>>>> It shouldn't work that way. When the log level is anything but
>>>>>>>> OFF,
>>>>> the
>>>>>>>> implementation is:
>>>>>>>>  public final boolean isLoggingEnabled() {
>>>>>>>>    return getLowestLogLevel() != Log.LOG_LEVEL_OFF &&
>>>>>>> getCurrentLogLevel()
>>>>>>>> != Log.LOG_LEVEL_OFF;
>>>>>>>>  }
>>
>>>>>>> I guess I am seeing this because I misunderstood the logging
>>>>>>> levels.
>>>>>>> I was assuming that if I compiled at DEBUG level, it would
>>>>>>> automatically include levels below it.
>>>>>>> I compiled for DEBUG, and set the runtime log_level to INFO.  
>>>>>>> Then
>>>>>>> if
>>>>>>> I
>>>>>>> call isLoggingEnabled(), it returns false.
>>
>>>>>>> Does this mean that there is no inherent hierarchy in the levels
>>>>>>> like
>>>>>>> log4j has, and that I have to specify compilation for all levels
>>>>>>> that
>>>>>>> I need?
>>
>>>>>>>>> Thanks
>>>>>>>>> Sunil.
>>
>> --
>> Fred Sauer
>> [EMAIL PROTECTED] Hide quoted text -
>>
>> - Show quoted text -
> >
>


-- 
Fred Sauer
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to