Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1006461 // logOutput2 - logs all program output to disk in a text file per session

JavaX fragment (include)

1  
static void logOutput2() {
2  
  File _logFile = null;
3  
  while licensed {
4  
    _logFile = getProgramFile(ymd() + "-" + hms() + ".txt");
5  
    if (_logFile.exists()) sleep(50); else break;
6  
  }
7  
  final File logFile = _logFile;
8  
  
9  
  set(getJavaX(), "customSystemOut", new Appendable() {
10  
    // only using this one
11  
    public Appendable append(CharSequence cs) {
12  
      appendToTextFile(logFile, cs.toString());
13  
      return this;
14  
    }
15  
16  
    public Appendable append(char c) { return this; }
17  
    public Appendable append(CharSequence s, int start, int end) { return this; }
18  
  });
19  
}

Author comment

Began life as a copy of #1002226

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006461
Snippet name: logOutput2 - logs all program output to disk in a text file per session
Eternal ID of this version: #1006461/1
Text MD5: 1c351c2857221298ff18a4cf0226bd41
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-01-05 15:23:39
Source code size: 587 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 648 / 560
Referenced in: [show references]