persistence@glassfish.java.net

Re: How to use Java logger in Java SE? (including a proposal)

From: Tom Ware <tom.ware_at_oracle.com>
Date: Mon, 11 Sep 2006 10:12:43 -0400

Hi Wonseok,

  I think this is a good proposal. My only suggestion is that we might
want to have the specified logger override the one specified in the
server platform.

-Tom

Wonseok Kim wrote:

> Hi, Tom, Marina
>
> May I propose this feature? This is simple to solve, so I have just
> implemented the prototype and worked fine.
>
> Property name: toplink.logging.logger
> Description: Specify the type of logger.
> Purpose: Let's make it easy to change the logger type in Java SE mode.
> Valid values: logger class name which implements
> oracle.toplink.essentials.logging.SessionLog
> or one of the following string values.
> * DefaultSessionLog (default)
> * JavaLog
>
> Example: persistence.xml file
> <property name="toplink.logging.logger" value="JavaLog"/>
>
> This works similar to ServerPlatform.getSessionLog ().
> This property is only used if there is no ServerPlatform.
> If "toplink.target-server" property is specified, then the specified
> ServerPlatform's getSessionLog()
> is used to change the logger type and "toplink.logging.logger" will be
> ignored(warning is required?).
>
> Currently there are just two logger types - default and Java logger...
> Maybe another logger type can be added in the future.(such as log4j)
>
> The property name and valid values can be changed if there are better
> ones.
> This is just a proposal and comments are welcome... What do you think?
>
> Thanks
> - Wonseok
>
> On 9/6/06, *Wonseok Kim* <guruwons_at_gmail.com
> <mailto:guruwons_at_gmail.com>> wrote:
>
> I filed an issue for this.
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1096
> <https://glassfish.dev.java.net/issues/show_bug.cgi?id=1096>
>
> Also I wrote a blog with regard to the workaround Tom suggested
> (see issue comment).
> I couldn't extend NoServerPlatform because it's final class, so I
> extended ServerPlatformBase.
>
> Thanks
> - Wonseok
>
>
> On 9/5/06, *Tom Ware* < tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>> wrote:
>
> Hi Wonseok,
>
> You are correct, there is no current configuration option
> that lets
> you automatically change the logger. That would be a good feature
> request to enter in the issue tracker.
>
> I believe your best bet is to subclass NoServerPlatform and
> override
> the getServerLog() method in the same way as it is implemented in
> SunAS9ServerPlatform.
>
> -Tom
>
> Wonseok Kim wrote:
>
>> Hi, all
>>
>> After I see the discussion thread about issue#988 - Logging
>> integration with GF happens too late,
>> I got a question about logger in Java SE mode.
>> Java logger (JavaLog) can be used by configuring
> ServerPlatform (like
>> GlassFish), but can it be used in Java SE also?
>> I can't see any configuration for changing logger - only
>> DefaultSessionLog is used.
>>
>> If it cannot be changed in current implementation, how about
> making
>> the property like "toplink.logging.logger=<logger_classname>"?
>> I think it can be also used in Java EE environment. Then it
> doesn't
>> need to implement ServerPlatform class to change only logger
> in other
>> Java EE container environment.
>>
>> Thanks
>> --
>> Wonseok Kim
>> Senior Developer, TmaxSoft
>
>
>