Thanks, I was wondering about that considering the JavaDoc indicates that it does 
nothing.  I'll try it.

>>> [EMAIL PROTECTED] 01/08/02 09:44AM >>>

 
You need to call activateOptions() after setting the properties for them to take 
effect (in your code, right before the call to addAppender).
  Will Wood <[EMAIL PROTECTED]> wrote: ** High Priority **

We're using 1.1.3 and have hit upon an issue when using the FileAppender or 
ConsoleAppender. 
If we use the no argument Constructors for FileAppender or ConsoleAppender and then
set the Layout and either File or Target for the respective appender we get an error

log4j:ERROR No output stream or file set for the appender

Even though the Target (for ConsoleAppender) or File (for FileAppender is set.)

If we use the Argument based Constructor, it works.

Any Ideas??

Attached is a sample that shows the problem

import org.apache.log4j.*;

public class Bug
{

public static void main(String[] args)
{
Category c = Category.getRoot();
c.removeAllAppenders();

PatternLayout l = new PatternLayout("%p %t %C:%M %m%n");

ConsoleAppender app = new ConsoleAppender();
app.setLayout(l);
app.setTarget(ConsoleAppender.SYSTEM_OUT);

c.addAppender(app);

c.error("Test."); // fails with "log4j:ERROR No output stream or file set for the 
appender named [null].

c.removeAllAppenders();

c.addAppender(new ConsoleAppender(l, ConsoleAppender.SYSTEM_OUT));

c.error("Test again."); // works.

}
}


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



---------------------------------
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail.


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

Reply via email to