class specific logging level

2012-06-07 Thread aggarwal

Hi,

Is it possible to set logging level for few selected classes in appender to
DEBUG and rest all ERROR ? Is there any combination of filter that can do
this ?
-- 
View this message in context: 
http://old.nabble.com/class-specific-logging-level-tp33974515p33974515.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



Re: SMTPAppender MDC

2012-06-07 Thread ceki

Hi Zbynek,

Have you looked at logback? Its SMTPAppender [1] supports dynamically
setting the destination, thus addressing your requirement.

See also the document entitled Triggering an email containing the 
isolated logs of selected transactions [2] and in particular the 
section Selective triggering  recipient addressing with transaction 
isolation.


HTH,

[1] http://logback.qos.ch/manual/appenders.html#SMTPAppender
[2] http://logback.qos.ch/recipes/emailPerTransaction.html

--
Ceki
http://twitter.com/#!/ceki

On 07.06.2012 11:08, Zbynek Vavros wrote:


Hi,

Im using SMTPAppender with MDC to send emails with custom subject
and its working very nicely.

Now, I would like to specify email receivers according to MDC value, like :
MDC=a -  1...@email.com, 2...@email.com
MDC=b -  3...@emai..com, 4...@email.com

Is it possible via configuration ??

Thanks a lot

Zbynek



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



Re: SMTPAppender MDC

2012-06-07 Thread Jacob Kjome


Alternatively, if you want to stick with Log4j, try.

http://openutils.sourceforge.net/openutils-log4j/smtpappender.html


Jake


On Thu, 07 Jun 2012 11:40:31 +0200
 ceki c...@qos.ch wrote:

Hi Zbynek,

Have you looked at logback? Its SMTPAppender [1] supports dynamically
setting the destination, thus addressing your requirement.

See also the document entitled Triggering an email containing the isolated 
logs of selected transactions [2] and in particular the section Selective 
triggering  recipient addressing with transaction isolation.


HTH,

[1] http://logback.qos.ch/manual/appenders.html#SMTPAppender
[2] http://logback.qos.ch/recipes/emailPerTransaction.html

--
Ceki
http://twitter.com/#!/ceki

On 07.06.2012 11:08, Zbynek Vavros wrote:


Hi,

Im using SMTPAppender with MDC to send emails with custom subject
and its working very nicely.

Now, I would like to specify email receivers according to MDC value, like :
MDC=a -  1...@email.com, 2...@email.com
MDC=b -  3...@emai..com, 4...@email.com

Is it possible via configuration ??

Thanks a lot

Zbynek



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





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



Re: slf4j, log4j and PropertyConfigurator.configure

2012-06-07 Thread Jeff Sawatzky
Ah, good catch!

log4j was being automatically initialized once from the log4j.properties in the 
war. Then, when I load the multiple property files and combine them (which I 
use commons configuration to do) it was converting the INFO, stdout from a 
string to an array.

I've now escaped the , in my properties file and it seems to work fine now.

Thanks again!

Jeff.

On 2012-06-07, at 4:26 AM, ceki wrote:

 Hello Jeff,
 
 From the messages log4j outputs at configuration time, it very much
 looks like the root logger is defined twice with the second definition
 with no appender. Hence the log4j:WARN No appenders could be found
 for logger (com.loca.util.services.AppListener) message.
 
 HTH,
 -- 
 Ceki
 http://twitter.com/#!/ceki
 
 On 07.06.2012 00:26, Jeff Sawatzky wrote:
 
  I have a project where I am using slf4j with the log4j binder, and I
  am trying to configure log4j with the PropertyConfigurator.  The
  project allows for a common log4.properties file and a machine
  log4j.properties file, and at start up I load the two files, combine
  them into a Properties object, and then pass them to
  PropertyConfigurator.configure. But when I try to log using slf4j I
  get a log4j:WARN No appenders could be found for logger error on the
  class I am trying to log from.
 
 In my app startup I have..
 
 Properties props = //do work...
 LogManager.resetConfiguration();
 PropertyConfigurator.configure(props);
 
 but here is the output (with log4j.debug turned on)
 log4j: Parsing for [root] with value=[INFO, stdout].
 log4j: Level token is [INFO].
 log4j: Category root set to INFO
 log4j: Parsing appender named stdout.
 log4j: Parsing layout options for stdout.
 log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x - %m%n].
 log4j: End of parsing for stdout.
 log4j: Parsed stdout options.
 log4j: Finished configuring.
 log4j: Parsing for [root] with value=[INFO].
 log4j: Level token is [INFO].
 log4j: Category root set to INFO
 log4j: Finished configuring.
 log4j:WARN No appenders could be found for logger 
 (com.loca.util.services.AppListener).
 log4j:WARN Please initialize the log4j system properly.
 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
 more info.
 
 Shouldn't the logger for com.loca.util.services.AppListener use the root 
 appender that was configured?
 
 Thanks!
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 


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



Re: class specific logging level

2012-06-07 Thread Jacob Kjome


If you name your loggers by class name, then sure.  This is standard logging 
configuration, not some extra special workaround.


logger name=com.mypackage.Myclass
    level value=debug/
    !-- inherits A1 appender from root, applies only to com.mypackage.MyClass 
--

/logger
logger name=com.myotherpackage
    level value=debug/
    !-- inherits A1 appender from root, applies to all classes in 
com.myotherpackage --

/logger
root
    level value=error/
    appender-ref ref=A1/
/root


Jake

On Thu, 7 Jun 2012 01:51:07 -0700 (PDT)
 aggarwal akansha.ag...@gmail.com wrote:


Hi,

Is it possible to set logging level for few selected classes in appender to
DEBUG and rest all ERROR ? Is there any combination of filter that can do
this ?
--
View this message in context: 
http://old.nabble.com/class-specific-logging-level-tp33974515p33974515.html

Sent from the Log4j - Users mailing list archive at Nabble.com.


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





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



Re: class specific logging level

2012-06-07 Thread aggarwal

So when root level is ERROR and i set Myclass level to DEBUG, how will the
Myclass's DEBUG logs get logged since the root level is ERROR and it will
block the DEBUG logs ? What i know is that, if I set root level to DEBUG and
some particular class (say Myclass) logger level to ERROR then, all classes'
logs of DEBUG will get logged but not of Myclass as its restricted to ERROR.
But what I want is the vice-versa. I want ERROR level of all classes and
DEBUG of only few important classes. I am new to log4j so maybe what i am
sayin is wrong.



Jacob Kjome wrote:
 
 
 If you name your loggers by class name, then sure.  This is standard
 logging 
 configuration, not some extra special workaround.
 
 logger name=com.mypackage.Myclass
     level value=debug/
     !-- inherits A1 appender from root, applies only to
 com.mypackage.MyClass 
 --
 /logger
 logger name=com.myotherpackage
     level value=debug/
     !-- inherits A1 appender from root, applies to all classes in 
 com.myotherpackage --
 /logger
 root
     level value=error/
     appender-ref ref=A1/
 /root
 
 
 Jake
 
 On Thu, 7 Jun 2012 01:51:07 -0700 (PDT)
  aggarwal akansha.ag...@gmail.com wrote:
 
 Hi,
 
 Is it possible to set logging level for few selected classes in appender
 to
 DEBUG and rest all ERROR ? Is there any combination of filter that can do
 this ?
 -- 
 View this message in context: 
http://old.nabble.com/class-specific-logging-level-tp33974515p33974515.html
 Sent from the Log4j - Users mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/class-specific-logging-level-tp33974515p33979415.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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