You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Peter Steele <ps...@maxiscale.com> on 2008/06/11 20:34:42 UTC

How to set a FileAppender to STDOUT?

What do I need to specify in the File parameter to mean STDOUT? I have
this:

  <appender name="FILE" class="org.apache.log4j.FileAppender">
    <param name="File"   value="System.out"/>
  ...

which works in log4j but this just creates a file called System.out in
log4cxx. What's the magic formula?


Re: How to set a FileAppender to STDOUT?

Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
Peter Steele wrote:
> Our developers can set the log filename through an environment variable.
> I wanted to find an option that let them dump their logs to stdout,
> simply by using a "magic" filename, as you can do in log4j...
> 

I see. While lots of development testing options come to my mind from having 
them specify an alternate configuration file to using named pipes and the screen 
program if you can only have one console, none of them include 'System.out'.

I hope you find something workable for your team.

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

RE: How to set a FileAppender to STDOUT?

Posted by Peter Steele <ps...@maxiscale.com>.
Our developers can set the log filename through an environment variable.
I wanted to find an option that let them dump their logs to stdout,
simply by using a "magic" filename, as you can do in log4j...

-----Original Message-----
From: Jacob L. Anawalt [mailto:janawalt@geckosoftware.com] 
Sent: Wednesday, June 11, 2008 4:09 PM
To: Log4CXX User
Subject: Re: How to set a FileAppender to STDOUT?

Peter Steele wrote:
> Changing to ConsoleAppender isn't an option in our case
unfortunately...
> 

Would you mind sharing why it's not an option? I just see the ends of
writing to 
stdout and must be missing some critical difference.

Thank you,
-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Re: How to set a FileAppender to STDOUT?

Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
Peter Steele wrote:
> Changing to ConsoleAppender isn't an option in our case unfortunately...
> 

Would you mind sharing why it's not an option? I just see the ends of writing to 
stdout and must be missing some critical difference.

Thank you,
-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

RE: How to set a FileAppender to STDOUT?

Posted by Peter Steele <ps...@maxiscale.com>.
>Here's my un-magic invocation:
>
><appender name="FILE" class="org.apache.log4j.ConsoleAppender">

Changing to ConsoleAppender isn't an option in our case unfortunately...

Thanks for the reply...


Re: How to set a FileAppender to STDOUT?

Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
Peter Steele wrote:
> which works in log4j but this just creates a file called System.out in
> log4cxx. What's the magic formula?

Here's my un-magic invocation:

<appender name="FILE" class="org.apache.log4j.ConsoleAppender">
...

I hadn't thought to try this, so I looked it up for you. The API docs for 
FileAppender say:

Note that the special values "System.out" or "System.err" are no longer honored.

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Re: How to set a FileAppender to STDOUT?

Posted by Curt Arnold <ca...@apache.org>.
On Jun 11, 2008, at 1:34 PM, Peter Steele wrote:

> What do I need to specify in the File parameter to mean STDOUT? I have
> this:
>
>  <appender name="FILE" class="org.apache.log4j.FileAppender">
>    <param name="File"   value="System.out"/>
>  ...
>
> which works in log4j but this just creates a file called System.out in
> log4cxx. What's the magic formula?
>

The log4cxx API comments are a copy from the log4j API comments,  
log4cxx probably never supported the special values.  Don't know  
exactly when support was removed from log4j, but many years ago and  
maybe at the switch from log4j 1.1 to log4j 1.2.  If it is really  
important to you, then you may need to write a custom appender.

RE: How to set a FileAppender to STDOUT?

Posted by Peter Steele <ps...@maxiscale.com>.
>In Java, stdout is normally accessed using a console appender. Why are
you using this construct in the first place?

In the end it looks that we're not going to need to do this after all so
it is a moot point...

Peter

 


Re: How to set a FileAppender to STDOUT?

Posted by Jo...@kisters.de.
In Java, stdout is normally accessed using a console appender. Why are you 
using this construct in the first place?

Mit freundlichen Grüßen / Regards
Johannes Frank




"Peter Steele" <ps...@maxiscale.com> 
11.06.2008 20:34
Please respond to
"Log4CXX User" <lo...@logging.apache.org>


To
"Log4CXX User" <lo...@logging.apache.org>
cc

Subject
How to set a FileAppender to STDOUT?






What do I need to specify in the File parameter to mean STDOUT? I have
this:

  <appender name="FILE" class="org.apache.log4j.FileAppender">
    <param name="File"   value="System.out"/>
  ...

which works in log4j but this just creates a file called System.out in
log4cxx. What's the magic formula?