Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1352

Provide an public API do modify ConsoleTarget.SystemOut & Err

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • None

    Description

      I give via reflection access to System.out & System.err to ConsoleTarget.

      Field streamField = ConsoleTarget.class.getDeclaredField("stream");
      streamField.setAccessible(true);
      streamField.set(ConsoleTarget.SystemOut, System.out);
      streamField.set(ConsoleTarget.SystemErr, System.err);
      streamField.setAccessible(false);

      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.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            gaellalire Gael Lalire
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: