You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2022/02/19 08:22:00 UTC
[jira] [Commented] (LOG4J2-3395) How can I redirect sysout/syserr log message to file programmatically
[ https://issues.apache.org/jira/browse/LOG4J2-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17494914#comment-17494914 ]
Ralph Goers commented on LOG4J2-3395:
-------------------------------------
You should configure your appenders using an [Arbiter |https://logging.apache.org/log4j/2.x/manual/configuration.html#Arbiters]and then programmatically set the value the Aribter will base its decision on.
> How can I redirect sysout/syserr log message to file programmatically
> ----------------------------------------------------------------------
>
> Key: LOG4J2-3395
> URL: https://issues.apache.org/jira/browse/LOG4J2-3395
> Project: Log4j 2
> Issue Type: Question
> Components: API, Core
> Affects Versions: 2.17.1
> Reporter: Vasu
> Priority: Major
>
> I have an Java application that execute on hadoop cluster and I need to capture all the log message to either file or console based on user's choice. I Am creating Console and RollingFileAppender programmatically as [here|https://stackoverflow.com/questions/70996311/all-logs-are-not-going-to-file-when-file-logging-enabled] and I was able to redirect my application logs to file or console as desired. But my cluster logs (sysout or syserr) are always going to console. How can i overwrite this default behavior?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)