[logback-dev] [JIRA] (LOGBACK-1352) Provide an public API do modify ConsoleTarget.SystemOut & Err

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Nov 9 22:41:00 CET 2017


Gael Lalire created LOGBACK-1352:
------------------------------------

             Summary: Provide an public API do modify ConsoleTarget.SystemOut & Err
                 Key: LOGBACK-1352
                 URL: https://jira.qos.ch/browse/LOGBACK-1352
             Project: logback
          Issue Type: Improvement
            Reporter: Gael Lalire
            Assignee: Logback dev list
            Priority: Minor


I give via reflection access to System.out & System.err to ConsoleTarget.
{code:java}
Field streamField = ConsoleTarget.class.getDeclaredField("stream");
streamField.setAccessible(true);
streamField.set(ConsoleTarget.SystemOut, System.out);
streamField.set(ConsoleTarget.SystemErr, System.err);
streamField.setAccessible(false);{code}
Then I change the value of System.out & System.err, so they will create a call to info or error for each line received.

It would be nicer if I did not have to use reflection to do this.



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list