> -----Original Message-----
>
> There is actually no need to log to both stdout and stderr at the
> same time
> so it's just a matter of sending some output to one or the other
> from within
> the same class.  Maybe I should simply be logging at different
> levels?  Just
> want to know what the "standard" way of doing this is.

Sorry, I was making an incorrect assumption about how ConsoleAppender works.
It looks like you should be able to define two console appenders like so:

  <appender name="CONSOLE_OUT" class="org.apache.log4j.ConsoleAppender">
    <param name="target" value="System.out" />
    <layout ...
    </layout>
  </appender>

  <appender name="CONSOLE_ERR" class="org.apache.log4j.ConsoleAppender">
    <param name="target"    value="System.err" />
    <param name="threshold" value="ERROR" />
    <layout ...
    </layout>
  </appender>

I don't know how to keep ERROR and FATAL messages from going to System.out.
So if they're both just writing to the screen, you'll see duplicates of the
lower priority messages.  Also, I haven't tried this myself, so I can't
really vouch for it, but this should at least point you in the right
direction.

I'm still puzzled by why you want to do this.  If stdout and stderr are both
just writing to the screen, why differentiate them?  And if one is being
redirected to a file, why not use a file appender?

Anyway, I hope this helps.

-----------------------------------------------------------------
Colin MacDonald  |  Software Developer  |  Templar Corporation  |
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.393 / Virus Database: 223 - Release Date: 9/30/2002


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

Reply via email to