getConfigurationFileName()

2003-09-28 Thread Henrik Vendelbo
Is there a way that I can get the filename and absolute path for the file
used to configure log4j. Once I am up and running, I would like to be able
to check that I am indeed using the right configuration file.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getConfigurationFileName()

2003-09-28 Thread Scott Morgan
I agree that this would be a helpful way to determine what log4j config
file log4j uses (.properties or .xml).  However I have found my problem in
figuring out which config file to be even a bit more complex than which
file since I am usually loading log4j.xml form jar files it is always in
the root directory
/log4j.xml

This can be a time consuming process when you have 20 some odd jars that
you are loading.  I have resorted to simply printing all of the
significant loggers at startup;

public static void printLogLevels(String source) {
Enumeration e = LogManager.getCurrentLoggers();
while (e.hasMoreElements()) {
  Logger logger = (Logger) e.nextElement();
  if (logger.getLevel() != null ) {
if (!logger.getLevel().equals(null)) {
  System.out.println(source +   + logger.getName() +  is set to
level  +
  logger.getLevel());
}
  }
}
System.out.println(Finishing PrintLogLevels RootLogger is set to
level  + LogManager.getRootLogger().getLevel());
  }

It would be nice to also have a way to determine which jar loaded the
log4j config file.
-- 
Scott Morgan
President Adligo Inc.
Ph:  773-758-8735
Fax: 773-632-0568
http://www.adligo.com


 Is there a way that I can get the filename and absolute path for the
 file used to configure log4j. Once I am up and running, I would like to
 be able to check that I am indeed using the right configuration file.



 - To
 unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SMTPAppender and BufferSize.

2003-09-28 Thread Paul Smith
On Sun, 2003-09-28 at 04:03, [EMAIL PROTECTED] wrote:
 Greetings:
   I have what I hope to be a simple question.
 
   We are using the log4j implementation in JBoss 3.0.4.
 
   When I activate the SMTP Appender for ERROR level to send me an email
 for any exceptions and stack traces,
  I was under the impression that I could buffer events and have the
 email contain more than one log entry in the email body.
 
   I get an email for every single log entry. Am I way off base?

There are 2 important properties for SMTPAppender, the EvaluatorClass,
and the Threshold.  You have set the Threshold to Error, and the
appender is using the default EvaluatorClass which matches ERROR. 
Basically it's the EvaluatorClass property that determines WHEN to send
the email, and uses the Buffer of events received since the last
Triggering event.  Since you have the threshold set to ERROR, the
appender is only letting that 1 event get in the Buffer.  

Try setting the Threshold to INFO, and you should find the email you
receive should contain the last X INFO-and-above events plus the ERROR
event that triggered it.

 I have simply started using the commented config in the  log4j.xml supplied
 by Jboss.
 
 appender name=SMTP class=org.apache.log4j.net.SMTPAppender
 param name=Threshold value=ERROR/
 param name=To value=[EMAIL PROTECTED]/
 param name=From value=[EMAIL PROTECTED]/
 param name=Subject value=JBoss Sever Exception/
 param name=SMTPHost value=xxx.xxx.x.xx/
 param name=BufferSize value=10/
 layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=[%d{ABSOLUTE},%c{1}] %m%n/
 /layout
   /appender

If the Error message itself contains everything you need to know, then
this is fine, but at any rate I think the BufferSize is misleading
here.  Perhaps an issue to address with the JBoss team?

cheers,

Paul Smith


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]