Unless I am missing something, why not do it like this:
private transient Logger logger;
private Logger getLogger()
{
if (logger == null) {
logger = LoggerFactory.getLogger(Foo.class);
}
}
public void myMethod()
{
...
getLogger().debug("Something here");
}
On Thu, 2007-04-26 at 13:55 -0700, Eelco Hillenius wrote:
>
>
> great, a neat way to make logging even cheaper...
>
>
> instantiate all the time for each and every message :-)
>
> It doesn't get instantiated every time. For instance
> Log4jLoggerFactory creates one instance lazily and then does a map
> lookup. Of course, it is still more expensive then just referring to a
> static var, certainly for 'just logging'. But otoh it seems unlikely
> that this will every be a real problem in web applications.
>
> Eelco
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________ Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Philip A. Chapman
Desktop and Web Application Development:
Java, .NET, PostgreSQL, MySQL, MSSQL
Linux, Windows 2000, Windows XP
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
