You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by lavsara <sv...@yahoo.com> on 2012/01/05 07:47:24 UTC

log4j - optional parameter

Hi,
I need to add an optional parameter say "Encryption=true" to the
consoleappender in log4j.properties file
and in the Business class I need to check something like

if  (encryption) 
{
logger.debug(encrypt(message)); //encrypt() has the encryption logic.
}

I guess I have to extend consoleappender and have a getter/setter for
encryption property.
Is this a good approach? Or is there any other optimal way of acheiving
this?

Thanks,
lavsara
-- 
View this message in context: http://old.nabble.com/log4j---optional-parameter-tp33084256p33084256.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j - optional parameter

Posted by Scott Deboy <sc...@gmail.com>.
The feedback usually given is to use a different Logger named 'encryption'
and manage its logging threshold in the configuration file, so you can
control encryption logging separately from the other logger you are using
in this class.

On Wed, Jan 4, 2012 at 10:47 PM, lavsara <sv...@yahoo.com> wrote:

>
> Hi,
> I need to add an optional parameter say "Encryption=true" to the
> consoleappender in log4j.properties file
> and in the Business class I need to check something like
>
> if  (encryption)
> {
> logger.debug(encrypt(message)); //encrypt() has the encryption logic.
> }
>
> I guess I have to extend consoleappender and have a getter/setter for
> encryption property.
> Is this a good approach? Or is there any other optimal way of acheiving
> this?
>
> Thanks,
> lavsara
> --
> View this message in context:
> http://old.nabble.com/log4j---optional-parameter-tp33084256p33084256.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>