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
49
50
51
52
53
54
55
56
57
|
This directory contains program(s) that demonstrate how to use ACE's
Log_Msg class to record various information.
* test_log_msg.cpp: This program basically tests various
feature of the Log_Msg facility. It opens a log file and
writes some messages using different log priorities and
output stream.
You can invoke the program with or without command
parameters. When invoked with any parameters like,
./Log_Msg foobar
the log messages are direct to stdout (or, ostream in C++.)
In this case, the program simulates an error EWOULDBLOCK and
write an error log to stdout as,
would block
op_status and errnum work!
When invoked without any parameters, except does the same
test as above but logs to default log stream "stderr," the
program also demonstrates logging messages/errors with
different priority and changing the logging destination. A
sample output is,
would block
op_status and errnum work!
3.141600, hello = 10000
6.283200, world = 20000
6.283200, world = 20000
9.424800, world = 30000
12.566400, world = 40000
15.708000, world = 50000
HEXDUMP 48 bytes
01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 00 ................
10 00 00 00 20 00 00 00 40 00 00 00 80 00 00 00 .... ...@.......
00 01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 ................
./Log_Msg.EXE: (2710), badname: Function not implemented
In this test, there are two lines containing "world` =
20000." That's because in the program, both stderr and
stdout are "turned on" for logging before writing this log
message. The line containing "world = 30000" is written to
stdout only. Rest of the lines are all to the stderr. You
can examine this behavior by redirecting stderr and stdout
to different files.
The HEXDUMP output shows how to take an arbitrary object and
hexdump its content for debugging. Finally, the program
shows an ordinary use case of logging error messages using
the ACE_ERROR macro.
If you look into the program, there is also a demonstration
showing how to disable certain priorities of error message
temporarily.
|