-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlog4bash_driver.sh
More file actions
49 lines (42 loc) · 1010 Bytes
/
Copy pathlog4bash_driver.sh
File metadata and controls
49 lines (42 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
. ./log4bash.sh
SET_LOG_LEVEL_FROM_ARGV $*
LOG4BASH_INFO
while getopts ":ab" o; do
case "$o" in
a)
echo "Option a"
;;
b)
echo "Option b"
;;
\?)
if [ $OPTARG == "L" ]; then
OPTIND=$(( OPTIND + 1 ))
continue
fi
echo "Unknown option $OPTARG"
exit 1
;;
esac
done
shift $((OPTIND-1))
echo "First arg = $1"
echo "LOG_LEVEL = $( LOG_LEVEL_STRING $LOG_LEVEL )"
LOG_DEBUG "This is a DEBUG message"
LOG_INFO "This is an INFO message"
LOG_WARN "This is a WARN message"
LOG_ERR "This is an ERR message"
echo "Changing date format..."
LOG_DATE_FORMAT="%m/%d/%y"
LOG_DEBUG "This is a DEBUG message"
LOG_INFO "This is an INFO message"
LOG_WARN "This is a WARN message"
LOG_ERR "This is an ERR message"
echo "Changing LOG_OUTPUT to BOTH..."
LOG_OUTPUT=$LOG_OUTPUT_BOTH
LOG4BASH_INFO
LOG_DEBUG "This is a DEBUG message"
LOG_INFO "This is an INFO message"
LOG_WARN "This is a WARN message"
LOG_ERR "This is an ERR message"