Committed by
Gerrit Code Review
Enhanced onos-check-logs to search logs only up to the latest restart and to inc…
…lude all errors and exceptions with their full stack trace. Change-Id: I23aa6adef9fcd06f6231efdb5619e6e9ebf07b86
Showing
1 changed file
with
49 additions
and
5 deletions
... | @@ -7,10 +7,54 @@ | ... | @@ -7,10 +7,54 @@ |
7 | . $ONOS_ROOT/tools/build/envDefaults | 7 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 8 | ||
9 | remote=$ONOS_USER@${1:-$OCI} | 9 | remote=$ONOS_USER@${1:-$OCI} |
10 | -instance=$2 | ||
11 | 10 | ||
12 | -[ -n "$instance" ] && \ | 11 | +LOG=$ONOS_INSTALL_DIR/log/karaf.log* |
13 | - LOG=$ONOS_INSTALL_DIR/$KARAF_DIST/instances/$instance/data/log/karaf.log* || \ | ||
14 | - LOG=$ONOS_INSTALL_DIR/log/karaf.log* | ||
15 | 12 | ||
16 | -ssh $remote "egrep 'ERROR|Exception' $LOG" | 13 | +aux=/tmp/log.$$ |
14 | + | ||
15 | +if [ "$2" = "old" ]; then | ||
16 | + ssh $remote "egrep 'ERROR|Exception|Error' $LOG" | ||
17 | + | ||
18 | +else | ||
19 | + ssh $remote " | ||
20 | + tac $LOG | awk ' | ||
21 | + BEGIN { off = 0; fail = 0; } | ||
22 | + / org.apache.karaf.main.lock.SimpleFileLock lock/ { | ||
23 | + off = 1; | ||
24 | + exit fail; | ||
25 | + } | ||
26 | + | ||
27 | + / ERROR / { | ||
28 | + if (!off) { | ||
29 | + print \$0; | ||
30 | + exc = 0; | ||
31 | + fail = 1; | ||
32 | + } | ||
33 | + } | ||
34 | + / WARN / { | ||
35 | + if (!off && exc) { | ||
36 | + print \$0; | ||
37 | + exc = 0; | ||
38 | + } | ||
39 | + } | ||
40 | + | ||
41 | + /^[a-zA-Z0-9.]*(Exception|Error)/ { | ||
42 | + if (!off) { | ||
43 | + print \$0; | ||
44 | + exc = 1; | ||
45 | + fail = 1; | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
49 | + / at / { | ||
50 | + if (!off) { | ||
51 | + print \$0; | ||
52 | + } | ||
53 | + } | ||
54 | + END { exit fail; } | ||
55 | + ' > $aux | ||
56 | + status=\$? | ||
57 | + tac $aux && rm $aux | ||
58 | + exit \$status | ||
59 | + " | ||
60 | +fi | ... | ... |
-
Please register or login to post a comment