Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-370

Ensure trace streams "out" and "err" faithfully track System.out and System.err


    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.0.12, 4.0.2
    • Fix Version/s: 3.0.13, 4.0.3
    • Component/s: Rule Helpers
    • Labels:


      The special trace streams "out" and "err" are documented as being aliases for System.out and System.err. i.e

        traceln("out", "Hello")
        traceln("err", "Help!")

      are documented as being, respectively, aliases for


      The mapping from these two special trace ids to streams is established by inserting System.out and System.err into a hash table as part of class init for class Helper, essentially fixing the trace stream "out" to identify the value of System.out at the point of class init. This invalidates the documented behaviour if the app subsequently reassigns System.out, say to direct output to a logger. This implementation also makes the binding and, hence, actual destination of output messages dependent upon when the Byteman agent is loaded. If Byetman is loaded at boot time output goes to the original System.out. If it is laoded dynamically it goes to the stream installed by the app.

      The same applies for the binding of "err" to System.err and, also, for the binding of the special trace streams "dbg", "vrb" and "nzy" used for debug, verbose and (as yet unimplemented) noisy tracing to System.err. The latter 3 cases differ in that the named streams can be rebound by calling traceOpen. However, the default binding is still timing-dependent and does not reflect updates by the app. Also, if the associated trace stream for these 3 cases is closed using traceClose then output reverts to the original System.out not the one installed by the app.

      Helper should not rely on a mapping fixed at class init. It should detect "out" and "err" as special cases and always redirect output to the current System,out or System.err. It should also use the current value of System.out as the default stream for trace streams "dbg", "vrb" and "nzy" when there is no user opened trace stream associated with the identfiiers.

        Gliffy Diagrams




              • Assignee:
                adinn Andrew Dinn
                adinn Andrew Dinn
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: