| 1 |
|
| 2 |
|
| 3 |
This directory contains program(s) that demonstrate how to use ACE's |
| 4 |
Log_Msg class to record various information. |
| 5 |
|
| 6 |
* test_callback.cpp: This program tests the Log_Msg |
| 7 |
abstraction wrt writing to user defined callback objects. |
| 8 |
|
| 9 |
* test_ostream.cpp: This program illustrates how the |
| 10 |
ACE_Log_Msg abstraction can be used to write to |
| 11 |
stderr and to a file. For even more sophisticated |
| 12 |
use-cases of ACE_Log_Msg please see the |
| 13 |
$ACE_ROOT/netsvcs/clients/Logger/ examples. |
| 14 |
|
| 15 |
* test_log_msg.cpp: This program tests various feature of the |
| 16 |
Log_Msg facility. It opens a log file and writes some |
| 17 |
messages using different log priorities and output stream. |
| 18 |
|
| 19 |
You can invoke the program with or without command |
| 20 |
parameters. When invoked with any parameters like, |
| 21 |
|
| 22 |
./Log_Msg foobar |
| 23 |
|
| 24 |
the log messages are direct to stdout (or, ostream in C++.) |
| 25 |
In this case, the program simulates an error EWOULDBLOCK and |
| 26 |
write an error log to stdout as, |
| 27 |
|
| 28 |
would block |
| 29 |
op_status and errnum work! |
| 30 |
|
| 31 |
When invoked without any parameters, except does the same |
| 32 |
test as above but logs to default log stream "stderr," the |
| 33 |
program also demonstrates logging messages/errors with |
| 34 |
different priority and changing the logging destination. A |
| 35 |
sample output is, |
| 36 |
|
| 37 |
would block |
| 38 |
op_status and errnum work! |
| 39 |
3.141600, hello = 10000 |
| 40 |
6.283200, world = 20000 |
| 41 |
6.283200, world = 20000 |
| 42 |
9.424800, world = 30000 |
| 43 |
12.566400, world = 40000 |
| 44 |
15.708000, world = 50000 |
| 45 |
HEXDUMP 48 bytes |
| 46 |
01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 00 ................ |
| 47 |
10 00 00 00 20 00 00 00 40 00 00 00 80 00 00 00 .... ...@....... |
| 48 |
00 01 00 00 00 02 00 00 00 04 00 00 00 08 00 00 ................ |
| 49 |
./Log_Msg.EXE: (2710), badname: Function not implemented |
| 50 |
|
| 51 |
In this test, there are two lines containing "world` = |
| 52 |
20000." That's because in the program, both stderr and |
| 53 |
stdout are "turned on" for logging before writing this log |
| 54 |
message. The line containing "world = 30000" is written to |
| 55 |
stdout only. Rest of the lines are all to the stderr. You |
| 56 |
can examine this behavior by redirecting stderr and stdout |
| 57 |
to different files. |
| 58 |
|
| 59 |
The HEXDUMP output shows how to take an arbitrary object and |
| 60 |
hexdump its content for debugging. Finally, the program |
| 61 |
shows an ordinary use case of logging error messages using |
| 62 |
the ACE_ERROR macro. |
| 63 |
|
| 64 |
If you look into the program, there is also a demonstration |
| 65 |
showing how to disable certain priorities of error message |
| 66 |
temporarily. |
| 67 |
|