Log output » History » Version 2

David PICARD, 11/30/2017 11:12 AM

1 1 David PICARD
h1. Log output
2 1 David PICARD
3 2 David PICARD
h2. Log information messages (stdout)
4 2 David PICARD
5 1 David PICARD
To redirect the program output to a log file, simply use the shell '>' or '>>' operators. '>' overwrites the output file, whereas '>>' creates a new file or appends to an existing file. As a consequence, the latter should be used in the case of [[Batch processing]].
6 1 David PICARD
7 1 David PICARD
[[Batch processing]] example, with output redirected to @log.txt@ :
8 1 David PICARD
<pre>
9 1 David PICARD
$ for f in *; do szdist -i $f -t rawstd -o ../pro/${f%".szr"}.csv >> log.txt; done
10 2 David PICARD
</pre>
11 2 David PICARD
12 2 David PICARD
13 2 David PICARD
h2. Log error output (stderr)
14 2 David PICARD
15 2 David PICARD
It is very convenient to redirect error output to a file when doing [[batch processing]], since it allows to inspect the errors. Note the *2* !
16 2 David PICARD
17 2 David PICARD
<pre>
18 2 David PICARD
$ for f in *; do szdist -i $f -t rawstd -o ../pro/${f%".szr"}.csv 2>> log.txt; done
19 1 David PICARD
</pre>