Using Your Logger
You can either make your logger an Agent default logger, or a separate logger for logging just your messages.
Making Your Logger a Default Logger
The easiest way to do this is by adding your logger to the splitter definition in loggers.xml that defines the multiple outputs for the Agent default logger. A splitter definition can only name two loggers in its properties, so you must either replace one of the existing properties, or create a secondary splitter.
Here is how you would make your logger the alternative to writing log output to <installdir>\logs\agent.log:
<logger name="rwsf.agent.log" class="rwsf_core.createLogSplitter"
default="true">
<property name="logger1" value="stdout.info"/>
<property name="logger2" value="mylog.info"/>
</logger>
If you still want Agent output written to agent.log, but want it also to go to your log file, you must create a secondary splitter that is referenced from the main one:
<logger name="rwsf.agent.log" class="rwsf_core.createLogSplitter"
default="true">
<property name="logger1" value="stdout.info"/>
<property name="logger2" value="rwsf.agent.log2"/>
</logger>
<logger name="rwsf.agent.log2" class="rwsf_core.createLogSplitter"
default="true">
<property name="logger1" value="rwsf.agent.logfile.verbose"/>
<property name="logger2" value="mylog.info"/>
</logger>
With these definitions in place, you would now write your messages to the default Agent logger exactly as described in
Using the Default Logger in a Service.Separating Your Log Messages from the Agent Messages
To log your messages separately from Agent messages, you need to define your logger as described in
Defining Your Logger, but you do not have to add anything else to
loggers.xml.
To use a custom logger named mylog.info in a custom C++ service, do the following:
#include <rwsf/core/LogManager>
#include <rwsf/core/Logger>
Logger logger = rwsf::LogManager::getLogger("mylog.info");
logger.info("My log message");
All messages logged with logger go to the output file defined for mylog.info. These messages do not go to the outputs defined for Agent messages, and Agent messages do not go to the output file defined for your logger.