STDERR to log file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

STDERR to log file

Sumit Bhardwaj
Hello Experts,

Is there a way to redirect STDERR to log file using log4j2?

I am aware of the redirection  approach, but with that the size of the
output file become uncontrollable for 24X7 running applications.

Thanks in advance!

Best
Sumit
Reply | Threaded
Open this post in threaded view
|

Re: STDERR to log file

Doug Wegscheid
Look at https://stackoverflow.com/questions/1200175/log4j-redirect-stdout-to-dailyrollingfileappender

Sent from AT&T Yahoo Mail on Android
 
  On Tue, Jul 21, 2020 at 3:00 AM, Sumit Bhardwaj<[hidden email]> wrote:   Hello Experts,

Is there a way to redirect STDERR to log file using log4j2?

I am aware of the redirection  approach, but with that the size of the
output file become uncontrollable for 24X7 running applications.

Thanks in advance!

Best
Sumit
 
Reply | Threaded
Open this post in threaded view
|

Re: STDERR to log file

Gary Gregory-4
In reply to this post by Sumit Bhardwaj
See the Log4j io-streams module:

https://logging.apache.org/log4j/2.x/log4j-iostreams/index.html

You can use one of these streams and put it in System.err. Then you use a
normal Log4j configuration to tell where to log.

Gary

On Tue, Jul 21, 2020 at 3:00 AM Sumit Bhardwaj <[hidden email]>
wrote:

> Hello Experts,
>
> Is there a way to redirect STDERR to log file using log4j2?
>
> I am aware of the redirection  approach, but with that the size of the
> output file become uncontrollable for 24X7 running applications.
>
> Thanks in advance!
>
> Best
> Sumit
>