IsTraceEnabled question

4 messages Options
Embed this post
Permalink
Adrian Rodriguez-2

IsTraceEnabled question

Reply Threaded More More options
Print post
Permalink
I've recently started using NLog and I was wondering what the best
practices are in using the IsXEnabled methods.

>From using previous frameworks, I know that the logging methods perform
the check internally (IsXEnabled), but you might want to check before
calling the method if you are passing in a string format with object
args.

Does NLog work this way as well?

Thanks.

<adrian />



-------------------------------------------------------------------------
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/
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Francis1

Re: IsTraceEnabled question

Reply Threaded More More options
Print post
Permalink
Yes that's how I use it.

Regards,

Francis


-----Original Message-----
From: Adrian Rodriguez [mailto:[hidden email]]
Sent: Thursday, June 14, 2007 14:43
To: [hidden email]
Subject: [Nlog-list] IsTraceEnabled question

I've recently started using NLog and I was wondering what the best
practices are in using the IsXEnabled methods.

>From using previous frameworks, I know that the logging methods perform
the check internally (IsXEnabled), but you might want to check before
calling the method if you are passing in a string format with object
args.

Does NLog work this way as well?

Thanks.

<adrian />



-------------------------------------------------------------------------
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/
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list


-------------------------------------------------------------------------
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/
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Jaroslaw Kowalski

Re: IsTraceEnabled question

Reply Threaded More More options
Print post
Permalink
If you're doing heavy string concatenation, they yes, using IsXEnabled is
recommended, but the recommended way is to use positional parameters {0} {1}
{2} (similar to Console.WriteLine()).  NLog delays the actual formatting
until it's known to be needed, so you have very fast (not-)logging.

But your mileage may vary,

Jarek

----- Original Message -----
From: "Francis Gingras" <[hidden email]>
To: "'Adrian Rodriguez'" <[hidden email]>
Cc: <[hidden email]>
Sent: Thursday, June 14, 2007 12:09 PM
Subject: Re: [Nlog-list] IsTraceEnabled question


> Yes that's how I use it.
>
> Regards,
>
> Francis
>
>
> -----Original Message-----
> From: Adrian Rodriguez [mailto:[hidden email]]
> Sent: Thursday, June 14, 2007 14:43
> To: [hidden email]
> Subject: [Nlog-list] IsTraceEnabled question
>
> I've recently started using NLog and I was wondering what the best
> practices are in using the IsXEnabled methods.
>
>>From using previous frameworks, I know that the logging methods perform
> the check internally (IsXEnabled), but you might want to check before
> calling the method if you are passing in a string format with object
> args.
>
> Does NLog work this way as well?
>
> Thanks.
>
> <adrian />
>
>
>
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> Nlog-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>
>
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> Nlog-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>



-------------------------------------------------------------------------
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/
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Adrian Rodriguez-2

Re: IsTraceEnabled question

Reply Threaded More More options
Print post
Permalink
Ok.  Perfect.  I'm using parameters in all my logging statements.  I'm
not doing any concatenation.  I'll take out the IsXEnabled calls and now
the code won't be as verbose and ugly ;).

Thanks!

<adrian />

-----Original Message-----
From: Jaroslaw Kowalski [mailto:[hidden email]]
Sent: Thursday, June 14, 2007 6:09 PM
To: Francis Gingras; Adrian Rodriguez
Cc: [hidden email]
Subject: Re: [Nlog-list] IsTraceEnabled question

If you're doing heavy string concatenation, they yes, using IsXEnabled
is
recommended, but the recommended way is to use positional parameters {0}
{1}
{2} (similar to Console.WriteLine()).  NLog delays the actual formatting

until it's known to be needed, so you have very fast (not-)logging.

But your mileage may vary,

Jarek

----- Original Message -----
From: "Francis Gingras" <[hidden email]>
To: "'Adrian Rodriguez'" <[hidden email]>
Cc: <[hidden email]>
Sent: Thursday, June 14, 2007 12:09 PM
Subject: Re: [Nlog-list] IsTraceEnabled question


> Yes that's how I use it.
>
> Regards,
>
> Francis
>
>
> -----Original Message-----
> From: Adrian Rodriguez [mailto:[hidden email]]
> Sent: Thursday, June 14, 2007 14:43
> To: [hidden email]
> Subject: [Nlog-list] IsTraceEnabled question
>
> I've recently started using NLog and I was wondering what the best
> practices are in using the IsXEnabled methods.
>
>>From using previous frameworks, I know that the logging methods
perform

> the check internally (IsXEnabled), but you might want to check before
> calling the method if you are passing in a string format with object
> args.
>
> Does NLog work this way as well?
>
> Thanks.
>
> <adrian />
>
>
>
>
------------------------------------------------------------------------
-

> 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/
> _______________________________________________
> Nlog-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>
>
>
------------------------------------------------------------------------
-
> 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/
> _______________________________________________
> Nlog-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>



-------------------------------------------------------------------------
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/
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list