You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2011/01/15 21:59:54 UTC
Should Logger classes be transient?
Hello,
I'm using SLF4J and was wondering whether pages should declare:
private transient final Logger log = LoggerFactory
.getLogger(SomePage.class);
as members. I guess that accessing a page that was saved and then re-loaded
would result in breaking logging, as the variable would be set to null. I've no
idea how heavy-weight these Logger implementations are though and am worried
that they should not be declared in class scope.
What do experienced Wicket developers do to access logging?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Should Logger classes be transient?
Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Just to know.... Why a static variable is not serializable?
Because objects (instances) are serialized and static data belongs to the class and not instances.
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Should Logger classes be transient?
Posted by Fernando Wermus <fe...@gmail.com>.
Just to know.... Why a static variable is not serializable?
On Sat, Jan 15, 2011 at 7:44 PM, Emmanouil Batsis <ma...@abiss.gr> wrote:
>
>
> Quoting Alexandros Karypidis <ak...@yahoo.gr>:
>
>> I'm using SLF4J and was wondering whether pages should declare:
>>
>> private transient final Logger log = LoggerFactory
>> .getLogger(SomePage.class);
>>
>> as members. I guess that accessing a page that was saved and then
>> re-loaded
>> would result in breaking logging, as the variable would be set to null.
>> I've no
>> idea how heavy-weight these Logger implementations are though and am
>> worried
>> that they should not be declared in class scope.
>>
>
> Using static loggers has the benefit of non-serialization between other
> things, including consistency between instances. Making them final and
> private may be appropriate as well. Here's a snippet from our calipso wicket
> app:
>
> /**
> * Please make proper use of logging, see
> * http://www.owasp.org/index.php/Category
> * :Logging_and_Auditing_Vulnerability
> */
> private static final Logger logger = // call logger factory
>
>
> Cheers,
>
> Manos
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus
Re: Should Logger classes be transient?
Posted by Emmanouil Batsis <ma...@abiss.gr>.
Quoting Alexandros Karypidis <ak...@yahoo.gr>:
> I'm using SLF4J and was wondering whether pages should declare:
>
> private transient final Logger log = LoggerFactory
> .getLogger(SomePage.class);
>
> as members. I guess that accessing a page that was saved and then re-loaded
> would result in breaking logging, as the variable would be set to
> null. I've no
> idea how heavy-weight these Logger implementations are though and am worried
> that they should not be declared in class scope.
Using static loggers has the benefit of non-serialization between
other things, including consistency between instances. Making them
final and private may be appropriate as well. Here's a snippet from
our calipso wicket app:
/**
* Please make proper use of logging, see
* http://www.owasp.org/index.php/Category
* :Logging_and_Auditing_Vulnerability
*/
private static final Logger logger = // call logger factory
Cheers,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Should Logger classes be transient?
Posted by James Carman <ja...@carmanconsulting.com>.
try static
On Sat, Jan 15, 2011 at 3:59 PM, Alexandros Karypidis <ak...@yahoo.gr>wrote:
> Hello,
>
> I'm using SLF4J and was wondering whether pages should declare:
>
> private transient final Logger log = LoggerFactory
> .getLogger(SomePage.class);
>
> as members. I guess that accessing a page that was saved and then re-loaded
> would result in breaking logging, as the variable would be set to null.
> I've no
> idea how heavy-weight these Logger implementations are though and am
> worried
> that they should not be declared in class scope.
>
> What do experienced Wicket developers do to access logging?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>