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 Edmondo Porcu <Ed...@gottexbrokers.com> on 2012/02/13 10:31:03 UTC
Programmatically create a ConsoleAppender
Dear all,
I have a test-case where I want to add extra logging compared to my normal logging settings.
I have therefore create manually an appender, and add that to a logger. However,
PRIORITY.DEBUG is deprecated.
I am probably missing some information about how to add extra logging:
private final val mockRealTimeLogger= Logger.getLogger("MockRealTimeConnectorLogger")
mockRealTimeLogger.setLevel(Level.DEBUG)
val appender = new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n"));
appender.setThreshold(Priority.DEBUG)
mockRealTimeLogger.addAppender(appender)
Isn't this good?
Thank you very much
Edmondo Porcu
Associate - Financial software architect
Avenue de Rhodanie 48
1007 Lausanne
Switzerland.
Dir +41 (0) 21 560 30 82
Fax +41 (0) 21 617 71 55
Email : edmondo.porcu@gottexbrokers.com
The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Programmatically create a ConsoleAppender
Posted by Jacob Kjome <ho...@visi.com>.
Did you try compiling and it failed? That would be odd. Level is a Priority
[1], so setThreshold(Priority) should accept a Level.
[1]
http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/Level.html
Jake
On Mon, 13 Feb 2012 19:14:22 +0000
Edmondo Porcu <Ed...@gottexbrokers.com> wrote:
> But I can't pass Level.DEBUG to appender.setThreshold...right?
>
> Best Regards
> Edmondo
>
>
> Edmondo Porcu
>Financial software architect
>
>
>
> Avenue de Rhodanie 48
> 1007 Lausanne
> Switzerland.
>
> Dir +41 (0) 21 560 30 82
>Fax +41 (0) 21 617 71 55
> Email : edmondo.porcu@gottexbrokers.com
>
> The information in this email is confidential and may be legally privileged.
>If you are not the intended recipient, you must not read, use or disseminate
>the information. Although this email and any attachments are believed to be
>free of any virus or other defect that might affect any computer system into
>which it is received and opened, it is the responsibility of the recipient to
>ensure that it is virus free and no responsibility is accepted by the Gottex
>Group of Companies for any loss or damage arising in any way from its use.
>
> -----Original Message-----
>From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: lunedì, febbraio 13, 2012 6:32 PM
> To: Log4J Users List
> Subject: Re: Programmatically create a ConsoleAppender
>
> Level is the new Priority, just as Logger is the new Category. Try
> Level.DEBUG.
>
> Jake
>
> On Mon, 13 Feb 2012 09:31:03 +0000
> Edmondo Porcu <Ed...@gottexbrokers.com> wrote:
>> Dear all,
>> I have a test-case where I want to add extra logging compared to my normal
>>logging settings.
>>
>> I have therefore create manually an appender, and add that to a logger.
>>However,
>> PRIORITY.DEBUG is deprecated.
>>
>> I am probably missing some information about how to add extra logging:
>>
>> private final val mockRealTimeLogger=
>>Logger.getLogger("MockRealTimeConnectorLogger")
>> mockRealTimeLogger.setLevel(Level.DEBUG)
>> val appender = new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} [%t]
>>%-5p %c{1} - %m%n"));
>> appender.setThreshold(Priority.DEBUG)
>> mockRealTimeLogger.addAppender(appender)
>>
>>
>> Isn't this good?
>>
>> Thank you very much
>>
>> Edmondo Porcu
>> Associate - Financial software architect
>>
>>
>>
>> Avenue de Rhodanie 48
>> 1007 Lausanne
>> Switzerland.
>>
>> Dir +41 (0) 21 560 30 82
>>Fax +41 (0) 21 617 71 55
>> Email : edmondo.porcu@gottexbrokers.com
>>
>> The information in this email is confidential and may be legally privileged.
>>If you are not the intended recipient, you must not read, use or disseminate
>>the information. Although this email and any attachments are believed to be
>>free of any virus or other defect that might affect any computer system into
>>which it is received and opened, it is the responsibility of the recipient to
>>ensure that it is virus free and no responsibility is accepted by the Gottex
>>Group of Companies for any loss or damage arising in any way from its use.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
>For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Programmatically create a ConsoleAppender
Posted by Edmondo Porcu <Ed...@gottexbrokers.com>.
But I can't pass Level.DEBUG to appender.setThreshold...right?
Best Regards
Edmondo
Edmondo Porcu
Financial software architect
Avenue de Rhodanie 48
1007 Lausanne
Switzerland.
Dir +41 (0) 21 560 30 82
Fax +41 (0) 21 617 71 55
Email : edmondo.porcu@gottexbrokers.com
The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use.
-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com]
Sent: lunedì, febbraio 13, 2012 6:32 PM
To: Log4J Users List
Subject: Re: Programmatically create a ConsoleAppender
Level is the new Priority, just as Logger is the new Category. Try
Level.DEBUG.
Jake
On Mon, 13 Feb 2012 09:31:03 +0000
Edmondo Porcu <Ed...@gottexbrokers.com> wrote:
> Dear all,
> I have a test-case where I want to add extra logging compared to my normal
>logging settings.
>
> I have therefore create manually an appender, and add that to a logger.
>However,
> PRIORITY.DEBUG is deprecated.
>
> I am probably missing some information about how to add extra logging:
>
> private final val mockRealTimeLogger=
>Logger.getLogger("MockRealTimeConnectorLogger")
> mockRealTimeLogger.setLevel(Level.DEBUG)
> val appender = new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} [%t]
>%-5p %c{1} - %m%n"));
> appender.setThreshold(Priority.DEBUG)
> mockRealTimeLogger.addAppender(appender)
>
>
> Isn't this good?
>
> Thank you very much
>
> Edmondo Porcu
> Associate - Financial software architect
>
>
>
> Avenue de Rhodanie 48
> 1007 Lausanne
> Switzerland.
>
> Dir +41 (0) 21 560 30 82
>Fax +41 (0) 21 617 71 55
> Email : edmondo.porcu@gottexbrokers.com
>
> The information in this email is confidential and may be legally privileged.
>If you are not the intended recipient, you must not read, use or disseminate
>the information. Although this email and any attachments are believed to be
>free of any virus or other defect that might affect any computer system into
>which it is received and opened, it is the responsibility of the recipient to
>ensure that it is virus free and no responsibility is accepted by the Gottex
>Group of Companies for any loss or damage arising in any way from its use.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Programmatically create a ConsoleAppender
Posted by Jacob Kjome <ho...@visi.com>.
Level is the new Priority, just as Logger is the new Category. Try
Level.DEBUG.
Jake
On Mon, 13 Feb 2012 09:31:03 +0000
Edmondo Porcu <Ed...@gottexbrokers.com> wrote:
> Dear all,
> I have a test-case where I want to add extra logging compared to my normal
>logging settings.
>
> I have therefore create manually an appender, and add that to a logger.
>However,
> PRIORITY.DEBUG is deprecated.
>
> I am probably missing some information about how to add extra logging:
>
> private final val mockRealTimeLogger=
>Logger.getLogger("MockRealTimeConnectorLogger")
> mockRealTimeLogger.setLevel(Level.DEBUG)
> val appender = new ConsoleAppender(new PatternLayout("%d{ABSOLUTE} [%t]
>%-5p %c{1} - %m%n"));
> appender.setThreshold(Priority.DEBUG)
> mockRealTimeLogger.addAppender(appender)
>
>
> Isn't this good?
>
> Thank you very much
>
> Edmondo Porcu
> Associate - Financial software architect
>
>
>
> Avenue de Rhodanie 48
> 1007 Lausanne
> Switzerland.
>
> Dir +41 (0) 21 560 30 82
>Fax +41 (0) 21 617 71 55
> Email : edmondo.porcu@gottexbrokers.com
>
> The information in this email is confidential and may be legally privileged.
>If you are not the intended recipient, you must not read, use or disseminate
>the information. Although this email and any attachments are believed to be
>free of any virus or other defect that might affect any computer system into
>which it is received and opened, it is the responsibility of the recipient to
>ensure that it is virus free and no responsibility is accepted by the Gottex
>Group of Companies for any loss or damage arising in any way from its use.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org