PrintStream myStream = new PrintStream(System.out) {
    @Override
    public void println(String x) {
        super.println(System.currentTimeMillis() + ": " + x);
    }
};
System.setOut(myStream);
System.out.println("Hello World!");
-------------------------------------------------------------------------------
Output:
1420553422337: Hello World!

参考:http://stackoverflow.com/questions/27800326/hook-into-system-out-println-and-modify

相关文章:

  • 2022-12-23
  • 2021-08-03
  • 2021-04-17
  • 2021-09-12
  • 2021-08-03
  • 2022-12-23
  • 2021-06-19
  • 2021-08-01
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2021-07-27
  • 2021-11-06
  • 2021-12-26
相关资源
相似解决方案