you could create a simple eclipse template (or whatever IDE you like) that
generates the logger, automatically:

Eclipse >> Window >> Preferences >> Java >> Editor >> Templates >> New
give it a name, like logger, Java type members as context, and use the code
below as body:

${:import(org.slf4j.LoggerFactory, org.slf4j.Logger)}
private static final Logger logger =
LoggerFactory.getLogger(${enclosing_type}.class);


or similar code if you don't use slf4j.

This way you create the log line simply by typing logger<Ctrl+Space>

[]'s
On Tue, May 10, 2011 at 2:36 PM, Colin Decker <[email protected]> wrote:

> As mentioned both here and on stackoverflow, you can't inject a static
> final field. Personally, I consider the Logger injection Guice can do a
> novelty at most and not worth thinking about much. If you want a static
> final Logger, just create it like normal. It's not that much boilerplate.
> Alternatively, just don't worry about it not being final. Do you think
> someone's going to accidentally reassign it?
>
> --
> Colin
>
>
>
> On Tue, May 10, 2011 at 1:09 PM, Jarrod Roberson <
> [email protected]> wrote:
>
>> I know about IoC, DI and all the other theory, I don't need information on
>> that, I know what Guice does, I know what Spring does, I know how they do
>> things differently.
>>
>> What I do like the ability to say
>>
>> @Inject
>> private static Logger logger;
>>
>> and have Guice auto magically put the class name as the logger, it
>> relieves my team of mindless boilerplate code
>>
>> I just don't like the trade off of not being able to mark the logger
>> reference as final, I am just looking for some one with more experience with
>> Guice to
>> see if there is a way to do this with the final keyword still there.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" 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/google-guice?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" 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/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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/google-guice?hl=en.

Reply via email to