123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- Sample programs using Log4C
- ===========================
- Please refer to the developers guide in the doc directory for a fuller
- explanation of these examples.
- helloworld -- classic simple program that logs the message "Hello World!" using Log4C.
- This example is used in the developers guide to explain some fundamental Log4C
- concepts.
- helloworld1 -- again the classic hello world example but demonstrating a technique
- for wrapping Log4C API calls to make it easy to remove Log4C from your code and
- demonstrating how to use a macro so that you name the category for your file just
- once at the start of the file.
- application_1 -- most basic example of using log4c. Notice that you
- only have to setup the category. Log4c is more powerful and flexible
- if you use the log4crc file to setup the relationship between
- category, appender, and formatter.
- application_2 -- example of using log4c with custom written appenders
- and formatters. Notice in Makefile.am that the linking for
- application_2 includes an additional library. This is an example of
- how you as a user of log4c would add in appenders and formatters.
- application_3 -- example of using log4c with extended user information.
- You would use this if your logging wanted to add things like which
- process_id, which machine, or any other additional location information
- you wanted to add to your logging. Notice that you have to write
- your own formatter that knows to look for the additional information.
- log4crc -- Notice the specifiers of how the catgories from the two
- example applications are wired up to appenders and formatters. Notice
- how when specifying a layout and appender, the type= string must match
- the name of the appender/formatter given in the code, but that the
- name= can be any name you want. Try and alter the priority= settings,
- the appender and layout settings in log4crc and rerunning the examples
- to see how the config affects which error messages will be printed.
- A new category to log to a rollingfile appender has been added
- reread -- If you used the --enable-reread flag during ./configure, you
- can test log4crc reread by running application_2 for 30 seconds, and
- while it is running edit the log4crc file and change the output level
- for application 2 between debug and error using a second window. In
- the window running application_2 you should notice the logging
- behaviour changes accordingly
|